Commit bdf9ce8b authored by Ajit Deshmukh's avatar Ajit Deshmukh

Added the changes

parent dae219f7
...@@ -3,10 +3,16 @@ package ibase.webitm.ejb.dis; ...@@ -3,10 +3,16 @@ package ibase.webitm.ejb.dis;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.naming.InitialContext;
import ibase.system.config.AppConnectParm;
import ibase.utility.BaseLogger; import ibase.utility.BaseLogger;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ActionHandlerEJB; import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB; import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
import ibase.webitm.utility.ITMException; import ibase.webitm.utility.ITMException;
public class SalesQuotationAcknowledge extends ActionHandlerEJB{ public class SalesQuotationAcknowledge extends ActionHandlerEJB{
...@@ -15,8 +21,17 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{ ...@@ -15,8 +21,17 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{
Connection conn = null; Connection conn = null;
String errString = ""; String errString = "";
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB(); ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String quotType="",custCode="";
StringBuffer processDynXmlString = new StringBuffer();
int domId=0;
int lineNo = 0;
String processRequestResult="";
UserInfoBean userInfo = null;
try try
{ {
userInfo = getUserInfo();
AppConnectParm appConnect = new AppConnectParm();
InitialContext initialContext = new InitialContext(appConnect.getProperty());
BaseLogger.log("3", getUserInfo(), null, "SalesQuotationAcknowledge --> tranID MArch 9 2026["+tranID+"]"); BaseLogger.log("3", getUserInfo(), null, "SalesQuotationAcknowledge --> tranID MArch 9 2026["+tranID+"]");
conn = getConnection(); conn = getConnection();
...@@ -26,11 +41,56 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{ ...@@ -26,11 +41,56 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{
updateStatusPs.setString(1, tranID); updateStatusPs.setString(1, tranID);
int updateStatusCnt = updateStatusPs.executeUpdate(); int updateStatusCnt = updateStatusPs.executeUpdate();
BaseLogger.log("3", getUserInfo(), null, "SalesQuotationAcknowledge --> updateStatusCnt ["+updateStatusCnt+"]"); BaseLogger.log("3", getUserInfo(), null, "SalesQuotationAcknowledge --> updateStatusCnt ["+updateStatusCnt+"]");
if(updateStatusCnt>0) {
String fetchSQuotDetSql = "select quot_type, cust_code from sales_quot where quot_no = ?";
PreparedStatement fetchSQuotDetPs = conn.prepareStatement(fetchSQuotDetSql);
fetchSQuotDetPs.setString(1, tranID);
ResultSet fetchSQuotDetRs = fetchSQuotDetPs.executeQuery();
while(fetchSQuotDetRs.next()) {
quotType = checkNull(fetchSQuotDetRs.getString("quot_type"));
custCode = checkNull(fetchSQuotDetRs.getString("cust_code"));
}
processDynXmlString.append("<DocumentRoot><description>Datawindow Root</description><group0>");
processDynXmlString.append(
"<description>Group0 description</description><Header0><description>Header0 members</description>");
if(quotType.trim().equalsIgnoreCase("G")) {
String fetchHospitalMappingSql = "select CUST_CODE__STK, CUST_CODE__DIST from CUSTOMER_PREF_DIST where CUST_CODE = ?";
PreparedStatement fetchHospitalMappingPs = conn.prepareStatement(fetchHospitalMappingSql);
fetchHospitalMappingPs.setString(1, custCode);
ResultSet fetchHospitalMappingRs = fetchHospitalMappingPs.executeQuery();
while(fetchHospitalMappingRs.next()) {
domId++;
lineNo++;
processDynXmlString.append("<Detail3 dbID=':' domID='"+domId+"' objName=\"salesquot\" objContext=\"3\">");
processDynXmlString.append("<attribute pkNames=\"quot_no:line_no:\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
processDynXmlString.append("<line_no><![CDATA[").append(lineNo).append("]]></line_no>");
processDynXmlString.append("<cust_code><![CDATA[").append(custCode).append("]]></cust_code>");
processDynXmlString.append("<cust_code__stk><![CDATA[").append(checkNull(fetchHospitalMappingRs.getString("CUST_CODE__STK"))).append("]]></cust_code__stk>");
processDynXmlString.append("<cust_code__dist><![CDATA[").append(checkNull(fetchHospitalMappingRs.getString("CUST_CODE__DIST"))).append("]]></cust_code__dist>");
processDynXmlString.append("</Detail3>");
}
}
processDynXmlString.append("</Header0></group0></DocumentRoot>");
String salesQuotDet3Xml = processDynXmlString.toString();
BaseLogger.log("3", null, null, "userInfo::" + userInfo.toString() + "]");
BaseLogger.log("3", null, null, "salesQuotDet3Xml::" + salesQuotDet3Xml.toString() + "]");
MasterStatefulLocal masterStateful = (MasterStatefulLocal) initialContext
.lookup("ibase/MasterStatefulEJB/local");
processRequestResult = masterStateful.processRequest(userInfo, salesQuotDet3Xml, false, conn);
BaseLogger.log("3", null, null, "processRequest processRequestResultD" + processRequestResult + "]");
if(updateStatusCnt>0) {
conn.commit(); conn.commit();
return errString = itmDBAccessEJB.getErrorString("","SALESACK","","",conn); return errString = itmDBAccessEJB.getErrorString("","SALESACK","","",conn);
} }
}catch(Exception e) { }catch(Exception e) {
BaseLogger.log("3", getUserInfo(), null, "Exception from SalesQuotationAcknowledge updateStatus --["+e.getMessage()+"]"); BaseLogger.log("3", getUserInfo(), null, "Exception from SalesQuotationAcknowledge updateStatus --["+e.getMessage()+"]");
e.printStackTrace(); e.printStackTrace();
...@@ -38,4 +98,13 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{ ...@@ -38,4 +98,13 @@ public class SalesQuotationAcknowledge extends ActionHandlerEJB{
} }
return " "; return " ";
} }
private String checkNull(String input)
{
if(input == null)
{
input = "";
}
return input;
}
} }
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import java.io.StringReader;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.rmi.RemoteException; import java.rmi.RemoteException;
...@@ -15,8 +16,12 @@ import java.time.format.DateTimeFormatter; ...@@ -15,8 +16,12 @@ import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import ibase.ejb.CommonDBAccessEJB; import ibase.ejb.CommonDBAccessEJB;
import ibase.system.config.AppConnectParm; import ibase.system.config.AppConnectParm;
...@@ -76,7 +81,6 @@ public class ReqForQuotationAprv extends ValidatorEJB{ ...@@ -76,7 +81,6 @@ public class ReqForQuotationAprv extends ValidatorEJB{
LocalDate tranDate = LocalDate.now();// for tranDate LocalDate tranDate = LocalDate.now();// for tranDate
LocalTime tranTime = LocalTime.now(); LocalTime tranTime = LocalTime.now();
String tranDateStr = formatDateTime(tranDate, tranTime); String tranDateStr = formatDateTime(tranDate, tranTime);
String tranId = "";
String reqId = ""; String reqId = "";
String custCode = ""; String custCode = "";
String quotType = ""; String quotType = "";
...@@ -201,7 +205,7 @@ public class ReqForQuotationAprv extends ValidatorEJB{ ...@@ -201,7 +205,7 @@ public class ReqForQuotationAprv extends ValidatorEJB{
checkAppr2StatusRs = checkAppr2StatusPs.executeQuery(); checkAppr2StatusRs = checkAppr2StatusPs.executeQuery();
while (checkAppr2StatusRs.next()) { while (checkAppr2StatusRs.next()) {
String wfStatus = checkAppr2StatusRs.getString("WF_STATUS"); String wfStatus = checkNull(checkAppr2StatusRs.getString("WF_STATUS"));
if (wfStatus.equalsIgnoreCase("A")) { if (wfStatus.equalsIgnoreCase("A")) {
tranFlag = false; tranFlag = false;
...@@ -299,10 +303,30 @@ public class ReqForQuotationAprv extends ValidatorEJB{ ...@@ -299,10 +303,30 @@ public class ReqForQuotationAprv extends ValidatorEJB{
resvisedRatePstmt.setString(1, itemCode); resvisedRatePstmt.setString(1, itemCode);
ResultSet resvisedRateRs = resvisedRatePstmt.executeQuery(); ResultSet resvisedRateRs = resvisedRatePstmt.executeQuery();
while(resvisedRateRs.next()) { while(resvisedRateRs.next()) {
int distMargin = resvisedRateRs.getInt("PHY_ATTRIB_13"); String distMarginStr = checkNull(resvisedRateRs.getString("PHY_ATTRIB_13"));
int stockMargin = resvisedRateRs.getInt("PHY_ATTRIB_14"); String stockMarginStr = checkNull(resvisedRateRs.getString("PHY_ATTRIB_14"));
int retailMargin = resvisedRateRs.getInt("PHY_ATTRIB_15"); String retailMarginStr = checkNull(resvisedRateRs.getString("PHY_ATTRIB_15"));
int distMargin = 0;
int stockMargin = 0;
int retailMargin = 0;
try {
distMargin = (distMarginStr != null && distMarginStr.trim().length() > 0)
? Integer.parseInt(distMarginStr.trim())
: 0;
stockMargin = (stockMarginStr != null && stockMarginStr.trim().length() > 0)
? Integer.parseInt(stockMarginStr.trim())
: 0;
retailMargin = (retailMarginStr != null && retailMarginStr.trim().length() > 0)
? Integer.parseInt(retailMarginStr.trim())
: 0;
} catch (Exception e) {
BaseLogger.log("3", null, null, "Error parsing margin values");
}
BigDecimal rateBD = new BigDecimal(rate); BigDecimal rateBD = new BigDecimal(rate);
BigDecimal hundred = new BigDecimal(100); BigDecimal hundred = new BigDecimal(100);
...@@ -361,6 +385,35 @@ public class ReqForQuotationAprv extends ValidatorEJB{ ...@@ -361,6 +385,35 @@ public class ReqForQuotationAprv extends ValidatorEJB{
rfqDetPstmt = null; rfqDetPstmt = null;
} }
//Detail3 XML Building start - 19 March
/*
* BaseLogger.log("3", null, null, "quotType::" + quotType.toString() + "]");
* BaseLogger.log("3", null, null, "custCode::" + custCode.toString() + "]");
*
* if(quotType.trim().equalsIgnoreCase("G")) { String fetchHospitalMappingSql =
* "select CUST_CODE__STK, CUST_CODE__DIST from CUSTOMER_PREF_DIST where CUST_CODE = ?"
* ; PreparedStatement fetchHospitalMappingPs =
* conn.prepareStatement(fetchHospitalMappingSql);
* fetchHospitalMappingPs.setString(1, custCode); ResultSet
* fetchHospitalMappingRs = fetchHospitalMappingPs.executeQuery();
* while(fetchHospitalMappingRs.next()) {
* processDynXmlString.append("<Detail3 dbID=':' domID='"
* +domId+"' objName=\"salesquot\" objContext=\"3\">"); processDynXmlString.
* append("<attribute pkNames=\"quot_no:line_no:\" selected=\"N\" updateFlag=\"A\" status=\"N\" />"
* ); processDynXmlString.append("<line_no><![CDATA[").append(lineNo).append(
* "]]></line_no>");
* processDynXmlString.append("<cust_code><![CDATA[").append(custCode).append(
* "]]></cust_code>");
* processDynXmlString.append("<cust_code__stk><![CDATA[").append(checkNull(
* fetchHospitalMappingRs.getString("CUST_CODE__STK"))).append(
* "]]></cust_code__stk>");
* processDynXmlString.append("<cust_code__dist><![CDATA[").append(checkNull(
* fetchHospitalMappingRs.getString("CUST_CODE__DIST"))).append(
* "]]></cust_code__dist>"); processDynXmlString.append("</Detail3>"); } }
*/
//Detail3 XML Building end - 19 March
processDynXmlString.append("</Header0></group0></DocumentRoot>"); processDynXmlString.append("</Header0></group0></DocumentRoot>");
...@@ -398,7 +451,63 @@ public class ReqForQuotationAprv extends ValidatorEJB{ ...@@ -398,7 +451,63 @@ public class ReqForQuotationAprv extends ValidatorEJB{
processRequestResult = masterStateful.processRequest(userInfo, salesQuotXml, false, conn); processRequestResult = masterStateful.processRequest(userInfo, salesQuotXml, false, conn);
BaseLogger.log("3", null, null, "processRequest processRequestResultD" + processRequestResult + "]"); BaseLogger.log("3", null, null, "processRequest processRequestResultD" + processRequestResult + "]");
if(processRequestResult != null && processRequestResult.trim().length() > 0)
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
InputSource is = new InputSource(new StringReader(processRequestResult));
Document doc = builder.parse(is);
// 🔹 Check SUCCESS
NodeList detailNodeList = doc.getElementsByTagName("Detail");
if(detailNodeList != null && detailNodeList.getLength() > 0)
{
String detailValue = detailNodeList.item(0).getTextContent();
if("Success".equalsIgnoreCase(detailValue))
{
BaseLogger.log("3", null, null, "Transaction SUCCESS");
// ✅ Success logic
String tranIdOfSalesQuotaion = doc.getElementsByTagName("TranID").item(0).getTextContent();
BaseLogger.log("3", null, null, "Generated Sales Quotaion TranID: " + tranIdOfSalesQuotaion);
BaseLogger.log("3", null, null, "RFQ TranID: " + tranID);
String UpdateRfqIdInSQuotSql = "update sales_quot set TRAN_ID__RFQ = ? where QUOT_NO = ?";
PreparedStatement UpdateRfqIdInSQuotPs = conn.prepareStatement(UpdateRfqIdInSQuotSql);
UpdateRfqIdInSQuotPs.setString(1, tranID);
UpdateRfqIdInSQuotPs.setString(2, tranIdOfSalesQuotaion);
int UpdateRfqIdInSQuotCount = UpdateRfqIdInSQuotPs.executeUpdate();
conn.commit();
BaseLogger.log("3", null, null, "Sales Quotation TRAN_ID__RFQ upadate count: "+UpdateRfqIdInSQuotCount);
String updateConfirm = "update sales_quot_req set confirmed = 'Y' where tran_id = ?";
PreparedStatement updateConfirmPs = conn.prepareStatement(updateConfirm);
updateConfirmPs.setString(1, tranID);
int updateConfirmCount = updateConfirmPs.executeUpdate();
conn.commit();
BaseLogger.log("3", null, null, "RFQ Confirmed Column update count: "+updateConfirmCount);
if (updateConfirmPs != null) {
updateConfirmPs.close();
updateConfirmPs = null;
}
}
}
else
{
BaseLogger.log("3", null, null, "Sales Quotation Generation Failed: ");
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
retString = processRequestResult; retString = processRequestResult;
} }
......
package ibase.webitm.ejb.dis; package ibase.webitm.ejb.dis;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.rmi.RemoteException; import java.rmi.RemoteException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -14,6 +15,7 @@ import java.util.ArrayList; ...@@ -14,6 +15,7 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
...@@ -559,8 +561,9 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -559,8 +561,9 @@ public class ReqForQuotationIC extends ValidatorEJB {
} }
} }
} }
setNodeValue(dom, "descr", itemSerDescr);
valueXmlString.append("<descr><![CDATA[" + itemSerDescr + "]]></descr>\n"); BaseLogger.log("0", null, userId, "case 1::: item_ser descr::"+itemSerDescr);
valueXmlString.append("<descr>").append("<![CDATA["+itemSerDescr+"]]>").append("</descr>\r\n");
} }
valueXmlString.append("</Detail1>"); valueXmlString.append("</Detail1>");
break; break;
...@@ -702,6 +705,10 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -702,6 +705,10 @@ public class ReqForQuotationIC extends ValidatorEJB {
} }
//PTR calculation end //PTR calculation end
valueXmlString.append("<rate_apprv>").append("<![CDATA["+MngmntAprvRate+"]]>").append("</rate_apprv>\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("<ptd>").append("<![CDATA["+ptd+"]]>").append("</ptd>\r\n");
...@@ -852,6 +859,21 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -852,6 +859,21 @@ public class ReqForQuotationIC extends ValidatorEJB {
//Management rate block[End] //Management rate block[End]
} }
if ("item_code".equalsIgnoreCase(currentColumn.trim())) {
String itemDescr = "";
BaseLogger.log("3", null, null, "ReqForQuotationIC in item_code ");
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
String itemDescrSql = "select descr from item where item_code = ?";
PreparedStatement itemDescrPs = con.prepareStatement(itemDescrSql);
itemDescrPs.setString(1, itemCode);
ResultSet itemDescrRs = itemDescrPs.executeQuery();
while(itemDescrRs.next()) {
itemDescr = itemDescrRs.getString("descr");
}
valueXmlString.append("<descr>").append("<![CDATA["+itemDescr+"]]>").append("</descr>\r\n");
}
if ("ptr_flag".equalsIgnoreCase(currentColumn.trim())) { if ("ptr_flag".equalsIgnoreCase(currentColumn.trim())) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flag "); BaseLogger.log("3", null, null, "ReqForQuotationIC in ptr_flag ");
String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom1)); String custCode = checkNull(genericUtility.getColumnValue("cust_code", dom1));
...@@ -874,11 +896,12 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -874,11 +896,12 @@ public class ReqForQuotationIC extends ValidatorEJB {
} }
if ("rate_quot".equalsIgnoreCase(currentColumn.trim())) { if ("rate_quot".equalsIgnoreCase(currentColumn.trim())) {
BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot ::"); BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot ::");
String rateQuot = genericUtility.getColumnValue("rate_quot", dom); 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 rateApprv = checkNull(genericUtility.getColumnValue("rate_apprv", dom));
String ratePtr = checkNull(genericUtility.getColumnValue("ptr", dom)); String ratePtr = checkNull(genericUtility.getColumnValue("ptr", dom));
BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot:: "+rateQuot+" rateApprv::"+rateApprv+ " ratePtr::"+ratePtr); BaseLogger.log("3", null, null, "ReqForQuotationIC in rate_quot:: "+rateQuot+" rateApprv::"+rateApprv+ " ratePtr::"+ratePtr+" itemCode::"+itemCode);
if (!rateQuot.isEmpty() && !rateApprv.isEmpty()) { if (!rateQuot.isEmpty() && !rateApprv.isEmpty()) {
...@@ -890,32 +913,18 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -890,32 +913,18 @@ public class ReqForQuotationIC extends ValidatorEJB {
//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) { if (rateApprvVal.compareTo(rateQuotVal) > 0) {
BaseLogger.log("3", null, null, "in rateApprvVal greater condition"); BaseLogger.log("3", null, null, "in rateApprvVal greater condition");
BaseLogger.log("3", null, null, "in rateApprvVal greater condition valueXmlString::"+ valueXmlString); BaseLogger.log("3", null, null, "in rateApprvVal greater condition valueXmlString::"+ valueXmlString);
String detail1Xml = "<mgmnt_apprv><![CDATA[Y]]></mgmnt_apprv><wf_status><![CDATA[P]]></wf_status>"; String detail1Xml = "<Detail1><mgmnt_apprv><![CDATA[Y]]></mgmnt_apprv><wf_status><![CDATA[P]]></wf_status></Detail1>";
int pos = valueXmlString.indexOf("<header>"); int pos = valueXmlString.indexOf("</header>");
if (pos != -1) { if (pos != -1) {
pos += "<header>".length(); // move after </header> pos += "</header>".length(); // move after </header>
valueXmlString.insert(pos, detail1Xml); valueXmlString.insert(pos, detail1Xml);
} }
...@@ -923,23 +932,95 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -923,23 +932,95 @@ public class ReqForQuotationIC extends ValidatorEJB {
} }
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);
}
//Added condition if ptr and special rate is same direct create the sales quotation
}
//Calculating Revised PTR,PTD and PTS [Start]
/* /*
* if (rateQuotVal.compareTo(ratePtrVal) == 0) { BaseLogger.log("3", null, null, * String resvisedRateSql =
* "In PTR and Special rate equal condition"); ReqForQuotationAprv * "select PHY_ATTRIB_13,PHY_ATTRIB_14,PHY_ATTRIB_15 from item where item_code = ?"
* reqForQuotationAprv = new ReqForQuotationAprv(); String domString = * ; PreparedStatement resvisedRatePstmt =
* genericUtility.serializeDom(dom).toString(); BaseLogger.log("3", null, null, * conn.prepareStatement(resvisedRateSql); resvisedRatePstmt.setString(1,
* "domString>>>>> "+domString); String result = * itemCode); ResultSet resvisedRateRs = resvisedRatePstmt.executeQuery(); while
* reqForQuotationAprv.updateWFStatus(domString, con, xtraParams); * (resvisedRateRs.next()) { String distMarginStr =
* BaseLogger.log("3", null, null, "ReqForQuotationAprv result>>>>> "+result); * checkNull(resvisedRateRs.getString("PHY_ATTRIB_13")); String stockMarginStr =
* checkNull(resvisedRateRs.getString("PHY_ATTRIB_14")); String retailMarginStr
* = checkNull(resvisedRateRs.getString("PHY_ATTRIB_15"));
*
* int distMargin = 0; int stockMargin = 0; int retailMargin = 0;
*
* try { distMargin = (distMarginStr != null && distMarginStr.trim().length() >
* 0) ? Integer.parseInt(distMarginStr.trim()) : 0;
*
* stockMargin = (stockMarginStr != null && stockMarginStr.trim().length() > 0)
* ? Integer.parseInt(stockMarginStr.trim()) : 0;
*
* retailMargin = (retailMarginStr != null && retailMarginStr.trim().length() >
* 0) ? Integer.parseInt(retailMarginStr.trim()) : 0;
*
* } catch (Exception e) { BaseLogger.log("3", null, null,
* "Error parsing margin values"); } BigDecimal rateBD = new
* BigDecimal(rateQuot);
*
* BigDecimal hundred = new BigDecimal(100);
*
* BigDecimal retailMarginBD = new BigDecimal(retailMargin); BigDecimal
* stockMarginBD = new BigDecimal(stockMargin); BigDecimal distMarginBD = new
* BigDecimal(distMargin);
*
* BaseLogger.log("3", null, null, "distMargin::" + distMargin +
* " stockMargin::" + stockMargin + " revisedPtd:: " + retailMargin + "rate:: "
* + rate + "]");
*
* BigDecimal revisedPtr =
* rateBD.divide(hundred.multiply(hundred.subtract(retailMarginBD)), 6,
* RoundingMode.HALF_UP);
*
* BigDecimal revisedPts =
* rateBD.divide(hundred.multiply(hundred.subtract(stockMarginBD)), 6,
* RoundingMode.HALF_UP);
*
* BigDecimal revisedPtd =
* rateBD.divide(hundred.multiply(hundred.subtract(distMarginBD)), 6,
* RoundingMode.HALF_UP);
*
* BaseLogger.log("3", null, null, "revisedPtr::" + revisedPtr + " revisedPts::"
* + revisedPts + " revisedPtd::" + revisedPtd); BaseLogger.log("3", null, null,
* "revisedPtr::" + revisedPtr + " revisedPts::" + revisedPts + " revisedPtd:: "
* + revisedPtd + "]");
* valueXmlString.append("<revised_ptr>").append("<![CDATA[" + revisedPtr +
* "]]>") .append("</revised_ptr>\r\n");
* valueXmlString.append("<revised_pts>").append("<![CDATA[" + revisedPts +
* "]]>") .append("</revised_pts>\r\n");
* valueXmlString.append("<revised_ptd>").append("<![CDATA[" + revisedPtd +
* "]]>") .append("</revised_ptd>\r\n");
* *
* } * }
*/ */
} //Calculating Revised PTR,PTD and PTS [End]
} }
valueXmlString.append("</Detail2>\r\n"); valueXmlString.append("</Detail2>\r\n");
break; break;
...@@ -948,7 +1029,7 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -948,7 +1029,7 @@ public class ReqForQuotationIC extends ValidatorEJB {
BaseLogger.log("3", null, null, "in rateApprvVal greater condition reStr>>>>> "+reStr); BaseLogger.log("3", null, null, "in rateApprvVal greater condition reStr>>>>> "+reStr);
valueXmlString.append("</Root>\r\n"); valueXmlString.append("</Root>\r\n");
} catch (Exception e) { } catch (Exception e) {
BaseLogger.log("3", getUserInfo(), null, "Exception :AssetAssign :itemChanged(Document,String):" + e.getMessage() + ":"); BaseLogger.log("3", getUserInfo(), null, "Exception :ReqForQuotationIC :itemChanged(Document,String):" + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
...@@ -957,7 +1038,7 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -957,7 +1038,7 @@ public class ReqForQuotationIC extends ValidatorEJB {
closeResources(rs, psPriceList, conn); closeResources(rs, psPriceList, conn);
} }
BaseLogger.log("3", getUserInfo(), null, "asset_assign valueXmlString::"+valueXmlString.toString()); BaseLogger.log("3", getUserInfo(), null, "ReqForQuotationIC valueXmlString::"+valueXmlString.toString());
return valueXmlString.toString(); return valueXmlString.toString();
} }
...@@ -993,7 +1074,24 @@ public class ReqForQuotationIC extends ValidatorEJB { ...@@ -993,7 +1074,24 @@ public class ReqForQuotationIC extends ValidatorEJB {
} }
return input; 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) public static boolean isDateInvalid(String validUptoStr)
{ {
try try
......
...@@ -52,6 +52,8 @@ public class ReqForQuotationSubmit extends ActionHandlerEJB ...@@ -52,6 +52,8 @@ public class ReqForQuotationSubmit extends ActionHandlerEJB
ibase.utility.E12GenericUtility genericUtility= null; ibase.utility.E12GenericUtility genericUtility= null;
ITMDBAccessEJB itmDBAccess = null; ITMDBAccessEJB itmDBAccess = null;
String ptr="",rateQuot=""; String ptr="",rateQuot="";
BigDecimal ratePtrVal = null;
BigDecimal rateQuotVal = null;
try try
{ {
...@@ -81,8 +83,16 @@ public class ReqForQuotationSubmit extends ActionHandlerEJB ...@@ -81,8 +83,16 @@ public class ReqForQuotationSubmit extends ActionHandlerEJB
} }
BigDecimal ratePtrVal = new BigDecimal(ptr);
BigDecimal rateQuotVal = new BigDecimal(rateQuot); if(ptr != null && ptr.trim().length() > 0)
{
ratePtrVal = new BigDecimal(ptr);
}
if(rateQuot != null && rateQuot.trim().length() > 0)
{
rateQuotVal = new BigDecimal(rateQuot);
}
String loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode"); String loginCode = genericUtility.getValueFromXTRA_PARAMS(xtraParams,"loginCode");
BaseLogger.log("3", null, null,"loginCode>>>>:"+loginCode); BaseLogger.log("3", null, null,"loginCode>>>>:"+loginCode);
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<!-- Root --> <xsl:output method="html"/>
<xsl:template match="/">
<html> <xsl:template match="/">
<head> <html>
<LINK type="text/css" rel="stylesheet" href="/ibase/css/display_budget.css"/> <head>
<LINK type="text/css" rel="stylesheet" href="/ibase/css/workflowsign.css"/>
</head> <LINK type="text/css" rel="stylesheet" href="/ibase/css/display_budget.css"/>
<body bgcolor="#EEEEEE"> <LINK type="text/css" rel="stylesheet" href="/ibase/css/workflowsign.css"/>
<div class="allDisplayDiv" style="background:#efefef; padding:1px;">
<xsl:apply-templates select="//Detail1"/> <style>
</div>
</body> body{
</html> background:#f5f6fa;
</xsl:template> font-family:Arial, Helvetica, sans-serif;
<!-- ========================= --> }
<!-- RFQ HEADER : Detail1 -->
<!-- ========================= --> .card{
<xsl:template match="Detail1"> margin:10px;
<!-- ========================= --> background:#fff;
<!-- Variables --> border:1px solid #ddd;
<!-- ========================= --> border-radius:6px;
<xsl:variable name="tran_id" select="TRAN_ID"/> padding:15px;
<xsl:variable name="tran_date" select="TRAN_DATE"/> }
<xsl:variable name="quot_type" select="QUOT_TYPE"/>
<xsl:variable name="cust_code" select="CUST_CODE"/> .title{
<xsl:variable name="contact_pers" select="CONTACT_PERS"/> font-size:18px;
<xsl:variable name="item_ser" select="ITEM_SER"/> font-weight:bold;
<xsl:variable name="req_date" select="REQ_DATE"/> margin-bottom:15px;
<xsl:variable name="valid_upto" select="VALID_UPTO"/> border-bottom:1px solid #eee;
<xsl:variable name="sales_pers" select="SALES_PERS"/> padding-bottom:8px;
<xsl:variable name="confirmed" select="CONFIRMED"/> text-align:left;
<!-- ========================= --> }
<!-- Header Section -->
<!-- ========================= --> .grid{
<div style="margin:8px; background:#fff; border:1px solid #dcdcdc; border-radius:6px; padding:10px;"> display:flex;
<div class="tTitleR" style="margin-bottom:10px; font-weight:bold;"> flex-wrap:wrap;
REQUEST FOR QUOTATION }
</div>
<div class="headDiv" style="display:flex; flex-wrap:wrap;"> .field{
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> width:50%;
<span class="tLabelR" style="display:inline-block; width:140px;">RFQ No :</span> margin-bottom:10px;
<span class="viewData"> }
<xsl:value-of select="tran_id"/>
</span> .label{
</div> font-weight:bold;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> width:150px;
<span class="tLabelR" style="display:inline-block; width:140px;">RFQ Date :</span> display:inline-block;
<span class="viewData"> color:#444;
<xsl:value-of select="tran_date"/> }
</span>
</div> .value{
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> color:#000;
<span class="tLabelR" style="display:inline-block; width:140px;">Quotation Type :</span> }
<span class="viewData">
<xsl:value-of select="quot_type"/> .tableCard{
</span> margin:10px;
</div> background:#fff;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> border:1px solid #ddd;
<span class="tLabelR" style="display:inline-block; width:140px;">Customer Code :</span> border-radius:6px;
<span class="viewData"> padding:10px;
<xsl:value-of select="cust_code"/> }
</span>
</div> .tableTitle{
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> font-weight:bold;
<span class="tLabelR" style="display:inline-block; width:140px;">Contact Person :</span> margin-bottom:8px;
<span class="viewData"> }
<xsl:value-of select="contact_pers"/>
</span> .tbl{
</div> width:100%;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> border-collapse:collapse;
<span class="tLabelR" style="display:inline-block; width:140px;">Item Series :</span> }
<span class="viewData">
<xsl:value-of select="item_ser"/> .tbl th{
</span> background:#f3f5f9;
</div> padding:8px;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> border:1px solid #ddd;
<span class="tLabelR" style="display:inline-block; width:140px;">Required Date :</span> font-size:13px;
<span class="viewData"> }
<xsl:value-of select="req_date"/>
</span> .tbl td{
</div> padding:8px;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> border:1px solid #ddd;
<span class="tLabelR" style="display:inline-block; width:140px;">Valid Upto :</span> font-size:13px;
<span class="viewData"> }
<xsl:value-of select="valid_upto"/>
</span> .tbl tr:nth-child(even){
</div> background:#fafafa;
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> }
<span class="tLabelR" style="display:inline-block; width:140px;">Sales Person :</span>
<span class="viewData"> .tbl tr:hover{
<xsl:value-of select="sales_pers"/> background:#eef3ff;
</span> }
</div>
<div class="tdDiv" style="width:50%; margin-bottom:6px;"> .right{
<span class="tLabelR" style="display:inline-block; width:140px;">Confirmed :</span> text-align:right;
<span class="viewData"> }
<xsl:value-of select="confirmed"/>
</span> </style>
</div>
</div> </head>
</div>
<!-- ========================= --> <body>
<!-- Item Details : Detail2 -->
<!-- ========================= --> <div>
<table width="100%" border="0"> <xsl:apply-templates select="//Detail1"/>
<tr> </div>
<td class="tTitleR" style="background:#fff; border:1px solid #ccc;">
Item Details </body>
</td> </html>
</tr> </xsl:template>
</table>
<div style="max-height:400px; overflow:auto;">
<table width="100%" border="1" cellpadding="5" cellspacing="0" <xsl:template match="Detail1">
style="border-collapse:collapse; background:#f9f9f9;">
<tr> <div class="card">
<th class="tLabel">Line No</th>
<th class="tLabel">Item Code</th> <div class="title">REQUEST FOR QUOTATION</div>
<th class="tLabel">Qty</th>
<th class="tLabel">Unit</th> <div class="grid">
<th class="tLabel">Pack</th>
<th class="tLabel">Special Rate</th> <div class="field">
<th class="tLabel">Approved Rate</th> <span class="label">RFQ No :</span>
<th class="tLabel">PTS (Price To Seller)</th> <span class="value"><xsl:value-of select="tran_id"/></span>
<th class="tLabel">PTD (Price To Dealer)</th> </div>
<th class="tLabel">Near Expiry</th>
<th class="tLabel">Remarks</th> <div class="field">
<span class="label">RFQ Date :</span>
</tr> <span class="value"><xsl:value-of select="tran_date"/></span>
<xsl:for-each select="//Detail2"> </div>
<xsl:variable name="dbID">
<xsl:value-of select="@dbID" /> <div class="field">
</xsl:variable> <span class="label">Quotation Type :</span>
<xsl:variable name="domID"> <span class="value">
<xsl:value-of select="@domID" /> <xsl:choose>
</xsl:variable> <xsl:when test="quot_type = 'C'">Customer</xsl:when>
<xsl:variable name="rate_quot"> <xsl:when test="quot_type = 'I'">Institute</xsl:when>
<xsl:value-of select="rate_quot" /> <xsl:when test="quot_type = 'G'">Group</xsl:when>
</xsl:variable> <xsl:otherwise><xsl:value-of select="quot_type"/></xsl:otherwise>
<tr> </xsl:choose>
<td> </span>
<xsl:value-of select="line_no"/> </div>
</td>
<td> <div class="field">
<xsl:value-of select="item_code"/> <span class="label">Customer :</span>
</td> <span class="value"><xsl:value-of select="cust_code"/></span>
<td style="text-align:right;"> </div>
<xsl:value-of select="qty_quot"/>
</td> <div class="field">
<td> <span class="label">Contact Person :</span>
<xsl:value-of select="unit"/> <span class="value"><xsl:value-of select="contact_pers"/></span>
</td> </div>
<td>
<xsl:value-of select="pack_code"/>
</td>
<td style="text-align:right;">
<xsl:value-of select="rate_quot"/>
</td>
<td style="text-align:right;">
<xsl:value-of select="rate_apprv"/>
</td>
<td>
<xsl:value-of select="pts"/>
</td>
<td>
<xsl:value-of select="ptd"/>
</td>
<td>
<xsl:value-of select="near_expiry"/>
</td>
<td>
<xsl:value-of select="remarks"/>
</td>
</tr>
</xsl:for-each>
</table>
</div>
</xsl:template>
</xsl:stylesheet>
<div class="field">
<span class="label">Item Series :</span>
<span class="value"><xsl:value-of select="item_ser"/></span>
</div>
<div class="field">
<span class="label">Required Date :</span>
<span class="value"><xsl:value-of select="req_date"/></span>
</div>
<div class="field">
<span class="label">Valid Upto :</span>
<span class="value"><xsl:value-of select="valid_upto"/></span>
</div>
<div class="field">
<span class="label">Sales Person :</span>
<span class="value"><xsl:value-of select="sales_pers"/></span>
</div>
</div>
</div>
<div class="tableCard">
<div class="tableTitle">Item Details</div>
<div style="max-height:400px; overflow:auto;">
<table class="tbl">
<tr>
<th>Line</th>
<th>Item</th>
<th>Qty</th>
<th>Unit</th>
<th>Pack</th>
<th>Competitor Item</th>
<th>Competitor Name</th>
<th>Competitor Rate</th>
<th>Special Rate</th>
<th>Approved</th>
<th>PTS</th>
<th>PTD</th>
<th>PTR</th>
<th>Remarks</th>
</tr>
<xsl:for-each select="//Detail2">
<tr>
<td><xsl:value-of select="line_no"/></td>
<td>
<xsl:value-of select="item_code"/>
<xsl:text> - </xsl:text>
<xsl:value-of select="descr"/>
</td>
<td class="right">
<xsl:value-of select="format-number(qty_quot,'0')"/>
</td>
<td><xsl:value-of select="unit"/></td>
<td><xsl:value-of select="pack_code"/></td>
<td><xsl:value-of select="competitor_item"/></td>
<td><xsl:value-of select="competitor_name"/></td>
<td class="right">
<xsl:value-of select="format-number(competitor_rate,'0')"/>
</td>
<td class="right">
<xsl:value-of select="format-number(rate_quot,'0')"/>
</td>
<td class="right">
<xsl:value-of select="format-number(rate_apprv,'0')"/>
</td>
<td class="right"><xsl:value-of select="pts"/></td>
<td class="right"><xsl:value-of select="ptd"/></td>
<td class="right"><xsl:value-of select="ptr"/></td>
<td><xsl:value-of select="remarks"/></td>
</tr>
</xsl:for-each>
</table>
</div>
</div>
</xsl:template>
</xsl:stylesheet>
...@@ -19,6 +19,8 @@ import java.sql.*; ...@@ -19,6 +19,8 @@ import java.sql.*;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.Format; import java.text.Format;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
...@@ -124,6 +126,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -124,6 +126,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{
int noOfChilds = 0; int noOfChilds = 0;
ArrayList prdList = new ArrayList(); ArrayList prdList = new ArrayList();
String paramValue=""; String paramValue="";
ArrayList<String> errList = new ArrayList<String>();
ArrayList<String> errFields = new ArrayList<String>();
String errCode = "";
String errorType = "";
StringBuffer errStringXml = new StringBuffer("<?xml version = \"1.0\"?> \r\n <Root> <Errors>");
try try
{ {
...@@ -180,8 +187,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -180,8 +187,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{
int custCodeCont = checkCustCodeRs.getInt("custCodeCount"); int custCodeCont = checkCustCodeRs.getInt("custCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationWiz custCode wfValData case 1 custCodeCont::[" + custCodeCont + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz custCode wfValData case 1 custCodeCont::[" + custCodeCont + "]");
if(custCodeCont<=0) { if(custCodeCont<=0) {
errString = getErrorString("cust_code", "VTCUST1", userId); //errString = getErrorString("cust_code", "VTCUST1", userId);
break; errCode="VTCUST1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
} }
...@@ -209,8 +218,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -209,8 +218,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{
int siteCodeCont = checkSiteCodeRs.getInt("siteCodeCount"); int siteCodeCont = checkSiteCodeRs.getInt("siteCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationWiz siteCode wfValData case 1 siteCodeCont::[" + siteCodeCont + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz siteCode wfValData case 1 siteCodeCont::[" + siteCodeCont + "]");
if(siteCodeCont<=0) { if(siteCodeCont<=0) {
errString = getErrorString("site_code", "VTSITCD1", userId); //errString = getErrorString("site_code", "VTSITCD1", userId);
break; errCode="VTSITCD1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
} }
...@@ -249,8 +260,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -249,8 +260,10 @@ public class ReqForQuotationWiz extends ValidatorEJB{
pstmt.close(); pstmt.close();
pstmt = null; pstmt = null;
if (count == 0) { if (count == 0) {
errString = getErrorString("item_ser", "VTITEMSER1", userId); //errString = getErrorString("item_ser", "VTITEMSER1", userId);
break; errCode="VTITEMSER1";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
} }
} }
...@@ -267,6 +280,21 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -267,6 +280,21 @@ public class ReqForQuotationWiz extends ValidatorEJB{
rs = null; rs = 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);
errCode="VTINUPTO";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
}
}
}//end of inner for loop }//end of inner for loop
}//end of first for loop }//end of first for loop
...@@ -299,6 +327,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -299,6 +327,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{
childNodeName = childNode.getNodeName(); childNodeName = childNode.getNodeName();
BaseLogger.log("3", null, null, "ReqForQuotationWiz childNodeName [" + childNodeName + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz childNodeName [" + childNodeName + "]");
if(childNodeName.trim().length()<=0) {
BaseLogger.log("3", null, null, "ReqForQuotationWiz detail 2 is blank");
}
if( childNodeName.equalsIgnoreCase("item_code") ) if( childNodeName.equalsIgnoreCase("item_code") )
{ {
String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom)); String itemCode = checkNull(genericUtility.getColumnValue("item_code", dom));
...@@ -311,11 +344,14 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -311,11 +344,14 @@ public class ReqForQuotationWiz extends ValidatorEJB{
int itemCodeCont = checkItemCodeRs.getInt("itemCodeCount"); int itemCodeCont = checkItemCodeRs.getInt("itemCodeCount");
BaseLogger.log("3", null, null, "ReqForQuotationWiz itemCode wfValData case 1 itemCodeCont::[" + itemCodeCont + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz itemCode wfValData case 1 itemCodeCont::[" + itemCodeCont + "]");
if(itemCodeCont<=0) { if(itemCodeCont<=0) {
errString = getErrorString("item_code", "STKVALITNE", userId); errCode="STKVALITNE";
break; errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
//errString = getErrorString("item_code", "STKVALITNE", userId);
} }
} }
if(checkItemCodeRs != null) if(checkItemCodeRs != null)
{ {
checkItemCodeRs.close(); checkItemCodeRs.close();
...@@ -329,6 +365,41 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -329,6 +365,41 @@ public class ReqForQuotationWiz extends ValidatorEJB{
} }
//Removed the validation from Quoted Quantity as it can be zero
/*
* if( childNodeName.equalsIgnoreCase("qty_quot") ) { int qty = 0; String
* quotQuantity = checkNull(genericUtility.getColumnValue("qty_quot", dom));
* BaseLogger.log("3", null, null,
* "ReqForQuotationWiz qty_quot wfValData case 2 [" + quotQuantity + "]");
* if(quotQuantity != null && quotQuantity.trim().length() > 0) { qty =
* Integer.parseInt(quotQuantity);
*
* }
*
* if(qty<=0) { errString = getErrorString("qty_quot", "NULNQUAN", userId);
* BaseLogger.log("3", null, null,
* "ReqForQuotationWiz in qty_quot < 0 errString:: [" + errString + "]"); break;
* } }
*/
if( childNodeName.equalsIgnoreCase("rate_quot") )
{
int quotedRate = 0;
String rateQuot = checkNull(genericUtility.getColumnValue("rate_quot", dom));
BaseLogger.log("3", null, null, "ReqForQuotationWiz rate_quot wfValData case 2 [" + rateQuot + "]");
if(rateQuot != null && rateQuot.trim().length() > 0)
{
quotedRate = Integer.parseInt(rateQuot);
}
if(quotedRate<=0) {
//errString = getErrorString("rate_quot", "NULNQRATE", userId);
errCode="NULNQRATE";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
BaseLogger.log("3", null, null, "ReqForQuotationWiz in qty_quot < 0 errString:: [" + errString + "]");
}
}
if( childNodeName.equalsIgnoreCase("ptr_flag") ) if( childNodeName.equalsIgnoreCase("ptr_flag") )
{ {
String ptrFlag = checkNull(genericUtility.getColumnValue("ptr_flag", dom)); String ptrFlag = checkNull(genericUtility.getColumnValue("ptr_flag", dom));
...@@ -349,9 +420,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -349,9 +420,11 @@ public class ReqForQuotationWiz extends ValidatorEJB{
|| (competitorItem == null || competitorItem.trim().isEmpty()) || (competitorItem == null || competitorItem.trim().isEmpty())
|| (competitorName == null || competitorName.trim().isEmpty())) { || (competitorName == null || competitorName.trim().isEmpty())) {
BaseLogger.log("3", null, null, "ReqForQuotationWiz in competitor details null [" + ptrFlag + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz in competitor details null [" + ptrFlag + "]");
errString = getErrorString("ptr_flag", "COMPDETM", userId); //errString = getErrorString("ptr_flag", "COMPDETM", userId);
errCode="COMPDETM";
errList.add(errCode);
errFields.add(childNodeName.toLowerCase());
BaseLogger.log("3", null, null, "ReqForQuotationWiz in competitor details null errString:: [" + errString + "]"); BaseLogger.log("3", null, null, "ReqForQuotationWiz in competitor details null errString:: [" + errString + "]");
break;
} }
} }
...@@ -362,7 +435,42 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -362,7 +435,42 @@ public class ReqForQuotationWiz extends ValidatorEJB{
break; break;
} }
}//end of validation of first form }//end of validation of first form
int errListSize = errList.size();
BaseLogger.log("3", getUserInfo(), null, "errListSize::::::::::"+errListSize);
int count = 0;
String errFldName = null;
if (errList != null && errListSize > 0)
{
for (count = 0; count < errListSize; count++)
{
errCode = errList.get(count);
errFldName = errFields.get(count);
BaseLogger.log("3", getUserInfo(), null, " testing :errCode .:" + errCode+"errString>>>>>>>>>"+errString);
errString = getErrorString(errFldName, errCode, userId);
errorType = errorType(conn, errCode);
if (errString.length() > 0)
{
String bifurErrString = errString.substring(errString.indexOf("<Errors>") + 8, errString.indexOf("<trace>"));
bifurErrString = bifurErrString + errString.substring(errString.indexOf("</trace>") + 8, errString.indexOf("</Errors>"));
errStringXml.append(bifurErrString);
errString = "";
}
if (errorType.equalsIgnoreCase("E"))
{
break;
}
}
errList.clear();
errList = null;
errFields.clear();
errFields = null;
errStringXml.append("</Errors> </Root> \r\n");
}//end of if for errList
else
{
errStringXml = new StringBuffer("");
}
errString = errStringXml.toString();
}//end of Try block wfvalData }//end of Try block wfvalData
catch(Exception e) catch(Exception e)
{ {
...@@ -464,7 +572,7 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -464,7 +572,7 @@ public class ReqForQuotationWiz extends ValidatorEJB{
} }
} }
}//end of finally block of wfvalData }//end of finally block of wfvalData
System.out.println("errString wfvalData ["+errString+"]"); System.out.println("errString wfvalData ReqForQuotationWiz:: ["+errString+"]");
return errString; return errString;
}//End WfValData }//End WfValData
...@@ -935,20 +1043,22 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -935,20 +1043,22 @@ public class ReqForQuotationWiz extends ValidatorEJB{
valueXmlString.append( "<Detail"+ objContext+" domID='"+domId +"' objContext = '"+currentFormNo+"' objName=\"rfq_wiz\" selected=\"N\">\r\n" ); valueXmlString.append( "<Detail"+ objContext+" domID='"+domId +"' objContext = '"+currentFormNo+"' objName=\"rfq_wiz\" selected=\"N\">\r\n" );
valueXmlString.append( "<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"tran_id:line_no\"/>\r\n" ); valueXmlString.append( "<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"tran_id:line_no\"/>\r\n" );
valueXmlString.append( "<tran_id/>" ); valueXmlString.append( "<tran_id/>" );
valueXmlString.append("<line_no protect = '1'><![CDATA[").append(lineNo).append("]]></line_no>"); valueXmlString.append("<line_no><![CDATA[").append(lineNo).append("]]></line_no>");
valueXmlString.append("<item_code><![CDATA[").append(itemCode).append("]]></item_code>"); valueXmlString.append("<item_code><![CDATA[").append(itemCode).append("]]></item_code>");
valueXmlString.append("<rate_apprv protect = '1'>").append("<![CDATA["+MngmntAprvRate+"]]>").append("</rate_apprv>\r\n"); valueXmlString.append("<rate_apprv>").append("<![CDATA["+MngmntAprvRate+"]]>").append("</rate_apprv>\r\n");
valueXmlString.append("<ptd protect = '1'>").append("<![CDATA["+ptd+"]]>").append("</ptd>\r\n"); valueXmlString.append("<ptd>").append("<![CDATA["+ptd+"]]>").append("</ptd>\r\n");
valueXmlString.append("<pts protect = '1'>").append("<![CDATA["+pts+"]]>").append("</pts>\r\n"); valueXmlString.append("<pts>").append("<![CDATA["+pts+"]]>").append("</pts>\r\n");
valueXmlString.append("<ptr protect = '1'>").append("<![CDATA["+rate+"]]>").append("</ptr>\r\n"); valueXmlString.append("<ptr>").append("<![CDATA["+rate+"]]>").append("</ptr>\r\n");
valueXmlString.append("<rate_quot protect = '0'>").append("<![CDATA[]]>").append("</rate_quot>"); valueXmlString.append("<rate_quot>").append("<![CDATA[]]>").append("</rate_quot>");
valueXmlString.append("<qty_quot protect = '0'>").append("<![CDATA[]]>").append("</qty_quot>"); valueXmlString.append("<qty_quot>").append("<![CDATA[]]>").append("</qty_quot>");
valueXmlString.append("<competitor_rate protect = '0'>").append("<![CDATA[]]>").append("</competitor_rate>"); valueXmlString.append("<competitor_rate>").append("<![CDATA[]]>").append("</competitor_rate>");
valueXmlString.append("<competitor_name protect = '0'>").append("<![CDATA[]]>").append("</competitor_name>"); valueXmlString.append("<competitor_name>").append("<![CDATA[]]>").append("</competitor_name>");
valueXmlString.append("<competitor_item protect = '0'>").append("<![CDATA[]]>").append("</competitor_item>"); valueXmlString.append("<competitor_item>").append("<![CDATA[]]>").append("</competitor_item>");
valueXmlString.append("<remarks protect = '0'>").append("<![CDATA[]]>").append("</remarks>"); valueXmlString.append("<remarks>").append("<![CDATA[]]>").append("</remarks>");
valueXmlString.append("<spec_instr protect = '0'>").append("<![CDATA[]]>").append("</spec_instr>"); valueXmlString.append("<pack_code>").append("<![CDATA[]]>").append("</pack_code>");
valueXmlString.append("<descr protect = '1'>").append("<![CDATA["+itemDescr+"]]>").append("</descr>"); valueXmlString.append("<unit>").append("<![CDATA[]]>").append("</unit>");
valueXmlString.append("<spec_instr>").append("<![CDATA[]]>").append("</spec_instr>");
valueXmlString.append("<descr>").append("<![CDATA["+itemDescr+"]]>").append("</descr>");
valueXmlString.append("</Detail"+objContext+">"); valueXmlString.append("</Detail"+objContext+">");
} }
...@@ -1111,7 +1221,27 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -1111,7 +1221,27 @@ public class ReqForQuotationWiz extends ValidatorEJB{
return objName; return objName;
} }
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 String checkNull( String inputVal ) private String checkNull( String inputVal )
{ {
...@@ -1121,4 +1251,51 @@ public class ReqForQuotationWiz extends ValidatorEJB{ ...@@ -1121,4 +1251,51 @@ public class ReqForQuotationWiz extends ValidatorEJB{
} }
return inputVal; return inputVal;
} }
private String errorType(Connection conn , String errorCode)
{
String msgType = "";
PreparedStatement pstmt = null ;
ResultSet rs = null;
try
{
String sql = "SELECT MSG_TYPE FROM MESSAGES WHERE MSG_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,errorCode);
rs = pstmt.executeQuery();
while(rs.next())
{
msgType = rs.getString("MSG_TYPE");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
}
catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
return msgType;
}
} }
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