Commit 9d35c721 authored by Ajit Deshmukh's avatar Ajit Deshmukh

Added the confirm button on the RFQ transaction screen, On confirmation of...

Added the confirm button on the RFQ transaction screen, On confirmation of transaction the Sales Quotation transaction will be create
parent a4d3f6da
Insert into OBJ_ACTIONS (OBJ_NAME,LINE_NO,IMAGE,DESCRIPTION,SERVICE_CODE,INTERACTIVE,RIGHTS_CHAR,TITLE,FORM_NO,SERVICE_HANDLER,PLACEMENT,ACTION_TYPE,TRAN_TYPE,CHG_DATE,CHG_TERM,CHG_USER,IS_CONFIRMATION_REQ,SEP_DUTY_OPT,RE_AUTH_OPT,SHOW_IN_PANEL,PAGE_CONTEXT,TYPE,ACTION_ARG,SWIPE_POSITION,MULTI_ROW_OPT,ACTION_ID,DEF_NODATA,IN_PROC_INTRUPT,ESTIMATED_TIME,ACTION_GROUP,DISPLAY_OPT,DISPLAY_MODE,SHOW_CONFIRM,REC_SPECIFIC) values
('rfq',5,'ibase/resource/objaction/confirm.svg','Confirmation','pre_confirm','a','F','Confirm','1','2',null,'U',null,null,null,null,null,null,null,null,null,null,null,'-1 ','1','confirm',null,null,null,null,null,'2','000',null);
Insert into SYSTEM_EVENTS (OBJ_NAME,EVENT_CODE,EVENT_CONTEXT,SERVICE_CODE,METHOD_RULE,OVERWRITE_CORE,CHG_DATE,CHG_USER,CHG_TERM,RESULT_HANDLE,COMP_TYPE,COMP_NAME,COMM_FORMAT,FIELD_NAME,FORM_NO) values
('rfq','pre_confirm','1','rfq_confirm',null,'0',to_date('01-JUL-16','DD-MON-RR'),'BASE','BASE','2','JB','ibase.webitm.ejb.dis.ReqForQuotationConfirm',null,null,null);
Insert into SYSTEM_EVENT_SERVICES (SERVICE_CODE,SERVICE_DESCR,SERVICE_URI,SERVICE_PROVIDER,METHOD_NAME,RETURN_VALUE,RETURN_TYPE,RETURN_DESCR,RETURN_XFRM,CHG_DATE,CHG_USER,CHG_TERM,SERVICE_NAMESPACE,RES_ELEM,SOAP_ACTION,SERVICE_TYPE,SERVICE_HANDLER,DESCR) values
('rfq_confirm','Confirm','http://localhost:9090/axis/services/ActionHandlerService','BASE','confirm','String','S',null,null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE',null,null,null,null,null,null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('rfq_confirm',1,'COMPONENT_TYPE','I','Component Type','C.String',null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE','JB');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('rfq_confirm',2,'COMPONENT_NAME','I','Component Name','C.String',null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE','ibase.webitm.ejb.dis.ReqForQuotationConfirm');
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('rfq_confirm',3,'<tran_id>','I','Tran ID','B.String',null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('rfq_confirm',4,'XTRA_PARAMS','I','xtraParams','S',null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE',null);
Insert into SYSTEM_SERVICE_ARGS (SERVICE_CODE,LINE_NO,ARG_NAME,ARG_MODE,DESCR,ARG_TYPE,ARG_XFRM,CHG_DATE,CHG_USER,CHG_TERM,ARG_VALUE) values ('rfq_confirm',5,'FORCED_FLAG','I','forcedFlag','S',null,to_date('08-AUG-16','DD-MON-RR'),'BASE','BASE',null);
Insert into PROFILE (PROFILE_ID,DESCR,CHG_DATE,CHG_USER,CHG_TERM,SEC_COMM_MODE,USER_LIC_TYPE,APPLICATION_PACK,USER_TYPE,DEPT_CODE__DEF,GRADE_CODE__DEF,CREATE_ENTITY_NEW) values
('MGNT','RFQ Confirmation Profile',to_date('02-JUL-26','DD-MON-RR'),'AJIT','TERM001',null,'E','',null,null,null,null);
Insert into PROFILE (PROFILE_ID,DESCR,CHG_DATE,CHG_USER,CHG_TERM,SEC_COMM_MODE,USER_LIC_TYPE,APPLICATION_PACK,USER_TYPE,DEPT_CODE__DEF,GRADE_CODE__DEF,CREATE_ENTITY_NEW) values
('QUOT','RFQ Confirmation Profile',to_date('02-JUL-26','DD-MON-RR'),'AJIT','TERM001',null,'E','',null,null,null,null);
Insert into USER_RIGHTS (PROFILE_ID,APPLICATION,MENU_ROW,MENU_COL,MENU_SUBCOL,LEVEL_4,LEVEL_5,MENU_NAME,RIGHTS,ACC_FILT,DEF_FILT,OBJ_NAME,FAV_OPTION,FAV_ORDER,EXCLUDE_RIGHTS_CHAR,ATTACH_RIGHTS,NO_OFFLINE_ALLWD,MOB_DEPLOY,DEVICE_SECURITY,DEVICE_ACC_CLASS) values
('MGNT','SCS',4,1,5,0,0,'Request For Quotation','F',null,null,'rfq',null,null,null,null,null,null,null,null);
Insert into USER_RIGHTS (PROFILE_ID,APPLICATION,MENU_ROW,MENU_COL,MENU_SUBCOL,LEVEL_4,LEVEL_5,MENU_NAME,RIGHTS,ACC_FILT,DEF_FILT,OBJ_NAME,FAV_OPTION,FAV_ORDER,EXCLUDE_RIGHTS_CHAR,ATTACH_RIGHTS,NO_OFFLINE_ALLWD,MOB_DEPLOY,DEVICE_SECURITY,DEVICE_ACC_CLASS) values
('QUOT','SCS',4,1,5,0,0,'Request For Quotation','F',null,null,'rfq',null,null,null,null,null,null,null,null);
/**
* PURPOSE : Request for quotation confirm component
* AUTHOR : Ajit Deshmukh
*/
package ibase.webitm.ejb.dis;
import java.io.StringReader;
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.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import org.w3c.dom.Document;
import java.util.Date;
import java.time.format.DateTimeFormatter;
import javax.naming.InitialContext;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import ibase.webitm.utility.ITMException;
import ibase.ejb.CommonDBAccessEJB;
import ibase.system.config.AppConnectParm;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.utility.UserInfoBean;
import ibase.webitm.ejb.ActionHandlerEJB;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.MasterStatefulLocal;
public class ReqForQuotationConfirm extends ActionHandlerEJB {
public String confirm(String tranID, String xtraParams, String forcedFlag) throws RemoteException, ITMException {
BaseLogger.log("3", getUserInfo(), null, "Calling ReqForQuotationConfirm.confirm().........");
BaseLogger.log("3", getUserInfo(), null, "Calling ReqForQuotationConfirm.confirm().........tranId:: " + tranID);
BaseLogger.log("3", getUserInfo(), null,
"Calling ReqForQuotationConfirm.confirm().........xtraParams:: " + xtraParams);
BaseLogger.log("3", getUserInfo(), null,
"Calling ReqForQuotationConfirm.confirm().........forcedFlag:: " + forcedFlag);
PreparedStatement rfqPstmt = null;
PreparedStatement rfqDetPstmt = null;
ResultSet rfqDetRs = null;
ResultSet rfqRs = null;
Connection conn = null;
E12GenericUtility genericUtility = new E12GenericUtility();
ITMDBAccessEJB itmdbAccessLocal = new ITMDBAccessEJB();
int domId = 0;
int rate = 0;
int updateConfirmCount = 0;
double updatedDistMargin = 0, updatedRetMargin = 0;
double updatedStkMargin = 0;
String revisedPTR = "", revisedPTD = "", revisedPTS = "";
StringBuffer processDynXmlString = new StringBuffer();
String errString = "", loginEmpCode = "", processRequestResult = "", quantity = "", itemCode = "", lineNo = "",
custCode = "", quotType = "",
itemSer = "", validUpto = "", salesPers = "", retString = "";
try {
LocalDate tranDate = LocalDate.now();// for tranDate
LocalTime tranTime = LocalTime.now();
String tranDateStr = formatDateTime(tranDate, tranTime);
loginEmpCode = checkNull(genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"));
BaseLogger.log("3", getUserInfo(), null,
"Calling ReqForQuotationConfirm.confirm().........loginEmpCode:: " + loginEmpCode);
if (conn == null) {
// ConnDriver connDriver = new ConnDriver();
// conn = connDriver.getConnectDB(userInfo.getTransDB());
conn = getConnection();
}
UserInfoBean userInfo = new UserInfoBean();
userInfo = getUserInfo();
CommonDBAccessEJB commonDBAccessEJB = new CommonDBAccessEJB();
AppConnectParm appConnect = new AppConnectParm();
InitialContext initialContext = new InitialContext(appConnect.getProperty());
String rfqSql = "select CUST_CODE ,QUOT_TYPE ,ITEM_SER, VALID_UPTO, SALES_PERS "
+ "FROM SALES_QUOT_REQ where tran_id = ?";
rfqPstmt = conn.prepareStatement(rfqSql);
rfqPstmt.setString(1, tranID);
rfqRs = rfqPstmt.executeQuery();
while (rfqRs.next()) {
// Directly fetching and using values from result set without declaring
// variables
custCode = checkNull(rfqRs.getString("CUST_CODE"));
quotType = checkNull(rfqRs.getString("QUOT_TYPE"));
itemSer = checkNull(rfqRs.getString("ITEM_SER"));
validUpto = checkNull(rfqRs.getString("VALID_UPTO"));
salesPers = checkNull(rfqRs.getString("SALES_PERS"));
// Do something with these values directly (e.g., use them in logic, or store in
// a collection)
System.out.println("custCode: " + custCode + ", " + "quotType: " + quotType + ", " + "validUpto: "
+ validUpto + ", " + "itemSer: " + itemSer);
}
if (rfqPstmt != null) {
rfqPstmt.close();
rfqPstmt = null;
}
if (rfqRs != null) {
rfqRs.close();
rfqRs = null;
}
// Start building the XML string
processDynXmlString.append("<DocumentRoot><description>Datawindow Root</description><group0>");
processDynXmlString.append(
"<description>Group0 description</description><Header0><description>Header0 members</description>");
processDynXmlString.append("<objName><![CDATA[salesquot]]></objName>");
processDynXmlString.append("<pageContext><![CDATA[1]]></pageContext>");
processDynXmlString.append("<objContext><![CDATA[1]]></objContext>");
processDynXmlString.append("<editFlag><![CDATA[A]]></editFlag>");
processDynXmlString.append("<focusedColumn><![CDATA[]]></focusedColumn>");
processDynXmlString.append("<action><![CDATA[SAVE]]></action>");
processDynXmlString.append("<elementName><![CDATA[]]></elementName>");
processDynXmlString.append("<keyValue><![CDATA[1]]></keyValue>");
processDynXmlString.append("<saveLevel><![CDATA[1]]></saveLevel>");
processDynXmlString.append("<forcedSave><![CDATA[false]]></forcedSave>");
processDynXmlString.append("<Detail1 dbID='' domID='1' objContext='1' objName='salesquot'>");
processDynXmlString
.append("<attribute IS_CHANGE='Y' pkNames='TRAN_ID' selected='N' status='N' updateFlag='A'/>");
// processDynXmlString.append("<tran_id/>");
processDynXmlString.append("<inq_date><![CDATA[" + dateFormatter(tranDateStr) + "]]></inq_date>");
processDynXmlString.append("<cust_code><![CDATA[" + custCode + "]]></cust_code>");
processDynXmlString.append("<sales_pers><![CDATA[" + salesPers + "]]></sales_pers>");
processDynXmlString.append("<quot_type><![CDATA[" + quotType + "]]></quot_type>");
processDynXmlString.append("<item_ser><![CDATA[" + itemSer.trim() + "]]></item_ser>");
processDynXmlString.append("<eff_date><![CDATA[" + dateFormatter(tranDateStr) + "]]></eff_date>");
processDynXmlString.append("<valid_upto><![CDATA[" + dateFormatter(validUpto) + "]]></valid_upto>");
processDynXmlString.append("<curr_code><![CDATA[INR]]></curr_code>");
processDynXmlString.append("<confirmed><![CDATA[N]]></confirmed>");
processDynXmlString.append("</Detail1>");
String rfqDet1Sql = "SELECT LINE_NO, ITEM_CODE, QTY_QUOT, RATE_QUOT FROM SALES_QUOT_REQ_DET WHERE tran_id = ?";
rfqDetPstmt = conn.prepareStatement(rfqDet1Sql);
rfqDetPstmt.setString(1, tranID);
rfqDetRs = rfqDetPstmt.executeQuery();
while (rfqDetRs.next()) {
domId++;
BaseLogger.log("3", getUserInfo(), null, "domId :: " + domId);
lineNo = checkNull(rfqDetRs.getString("LINE_NO"));
itemCode = checkNull(rfqDetRs.getString("ITEM_CODE"));
quantity = checkNull(rfqDetRs.getString("QTY_QUOT"));
rate = rfqDetRs.getInt("RATE_QUOT");
String resvisedRateSql = "select PHY_ATTRIB_13,PHY_ATTRIB_14,PHY_ATTRIB_15 from item where item_code = ?";
PreparedStatement resvisedRatePstmt = conn.prepareStatement(resvisedRateSql);
resvisedRatePstmt.setString(1, itemCode);
ResultSet resvisedRateRs = resvisedRatePstmt.executeQuery();
while (resvisedRateRs.next()) {
String distMarginStr = 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");
}
// if (roleCodeSign.equalsIgnoreCase("VHB_MNGMNT") ||
// roleCodeSign.equalsIgnoreCase("VHB_QUOT"))
// {
// BaseLogger.log("3", null, null, "ITEM updated for updatedRate VHB_MNGMNT[" +
// updatedRate + "]");
// if(updatedRate.trim().length() > 0)
// {
// BaseLogger.log("3", null, null, "Inside the updatedRate VHB_MNGMNT[" +
// updatedRate + "]");
// double rateDouble = Double.parseDouble(updatedRate);
// rate = (int) rateDouble;
// }
// }
BigDecimal rateBD = new BigDecimal(rate);
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 = BigDecimal.ZERO;
BigDecimal revisedPts = BigDecimal.ZERO;
BigDecimal revisedPtd = BigDecimal.ZERO;
// PTR
BigDecimal ptrDenominator = hundred.multiply(hundred.subtract(retailMarginBD));
if (ptrDenominator.compareTo(BigDecimal.ZERO) != 0) {
revisedPtr = rateBD.divide(ptrDenominator, 6, RoundingMode.HALF_UP);
} else {
BaseLogger.log("3", null, null, "PTR division skipped (denominator zero)");
}
// PTS
BigDecimal ptsDenominator = hundred.multiply(hundred.subtract(stockMarginBD));
if (ptsDenominator.compareTo(BigDecimal.ZERO) != 0) {
revisedPts = rateBD.divide(ptsDenominator, 6, RoundingMode.HALF_UP);
} else {
BaseLogger.log("3", null, null, "PTS division skipped (denominator zero)");
}
// PTD
BigDecimal ptdDenominator = hundred.multiply(hundred.subtract(distMarginBD));
if (ptdDenominator.compareTo(BigDecimal.ZERO) != 0) {
revisedPtd = rateBD.divide(ptdDenominator, 6, RoundingMode.HALF_UP);
} else {
BaseLogger.log("3", null, null, "PTD division skipped (denominator zero)");
}
BaseLogger.log("3", null, null, "revisedPtr::" + revisedPtr + " revisedPts::" + revisedPts
+ " revisedPtd::" + revisedPtd);
BaseLogger.log("3", null, null, "revisedPtr::" + revisedPtr + " revisedPts::" + revisedPts
+ " revisedPtd:: " + revisedPtd + "]");
processDynXmlString.append(
"<Detail2 dbID=':' domID='" + domId + "' objName=\"salesquot\" objContext=\"2\">");
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("<item_code><![CDATA[").append(itemCode).append("]]></item_code>");
processDynXmlString.append("<quantity><![CDATA[").append(quantity).append("]]></quantity>");
processDynXmlString.append("<rate><![CDATA[").append(rate).append("]]></rate>");
processDynXmlString.append("<ptr><![CDATA[").append(revisedPtr).append("]]></ptr>");
processDynXmlString.append("<pts><![CDATA[").append(revisedPts).append("]]></pts>");
processDynXmlString.append("<ptd><![CDATA[").append(revisedPtd).append("]]></ptd>");
processDynXmlString.append("</Detail2>");
}
if (resvisedRatePstmt != null) {
resvisedRatePstmt.close();
resvisedRatePstmt = null;
}
if (resvisedRateRs != null) {
resvisedRateRs.close();
resvisedRateRs = null;
}
}
if (rfqDetRs != null) {
rfqDetRs.close();
rfqDetRs = null;
}
if (rfqDetPstmt != null) {
rfqDetPstmt.close();
rfqDetPstmt = null;
}
// Detail3 XML Building end - 19 March
processDynXmlString.append("</Header0></group0></DocumentRoot>");
// Changes on 06-Feb-26 by Ajit [End]
// Now, processDynXmlString contains the dynamically generated XML with the
// values from your query
System.out.println(processDynXmlString.toString());
// String tranIDNew = commonDBAccessEJB.generateSeq("asset_assign_seq", 10,
// userInfo.getTransDB());
// BaseLogger.log("3", null, null, " generated tranID :: " + tranIDNew); //
// tran_id
// processDynXmlString.toString().replace("{{tranId}}", tranIdNew);
String salesQuotXml = processDynXmlString.toString();
BaseLogger.log("3", null, null, "userInfo::" + userInfo.toString() + "]");
BaseLogger.log("3", null, null, "salesQuotXml::" + salesQuotXml.toString() + "]");
String tranDb = userInfo.getTransDB();
BaseLogger.log("3", null, null, "tranDb::" + tranDb.toString() + "]");
MasterStatefulLocal masterStateful = (MasterStatefulLocal) initialContext
.lookup("ibase/MasterStatefulEJB/local");
processRequestResult = masterStateful.processRequest(userInfo, salesQuotXml,
false, conn);
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();
BaseLogger.log("3", null, null,
"Sales Quotation TRAN_ID__RFQ upadate count: " + UpdateRfqIdInSQuotCount);
if (UpdateRfqIdInSQuotPs != null)
UpdateRfqIdInSQuotPs.close();
conn.commit();
Connection connAfterProcess = null;
try {
connAfterProcess = getConnection();
String updateConfirm = "UPDATE sales_quot_req "
+ "SET confirmed='Y', "
+ "confirm_date=SYSDATE, "
+ "emp_code_conf=? "
+ "WHERE tran_id=?";
try (PreparedStatement ps = connAfterProcess.prepareStatement(updateConfirm)) {
ps.setString(1, loginEmpCode);
ps.setString(2, tranID);
updateConfirmCount = ps.executeUpdate();
}
connAfterProcess.commit(); // if auto-commit is false
} finally {
if (connAfterProcess != null) {
connAfterProcess.close();
}
}
// If execution reaches here, PreparedStatement has already been closed.
BaseLogger.log("3", null, null,
"PreparedStatement closed successfully");
System.out.println("updateConfirmCount is " + updateConfirmCount);
if (updateConfirmCount > 0) {
BaseLogger.log("3", null, null,
"Before getErrorString()");
try {
errString = itmdbAccessLocal.getErrorString(
"confirmed",
"VTCONFIRM",
"",
"",
conn);
BaseLogger.log("3", null, null,
"After getErrorString()");
BaseLogger.log("3", null, null,
"errString : " + errString);
System.out.println("errString is " + errString);
} catch (Exception e) {
BaseLogger.log("3", null, null,
"Exception inside getErrorString() : "
+ E12GenericUtility.getStackTrace(e));
throw e;
}
}
BaseLogger.log("3", null, null,
"Exiting confirmation block");
}
} else {
BaseLogger.log("3", null, null, "Sales Quotation Generation Failed: ");
}
} catch (Exception e) {
BaseLogger.log("3", null, null,
E12GenericUtility.getStackTrace(e));
throw e;
}
}
} catch (Exception e) {
BaseLogger.log("3", null, null,
E12GenericUtility.getStackTrace(e));
} finally {
try {
BaseLogger.log("3", null, null, "Entering finally block");
if (rfqRs != null) {
rfqRs.close();
BaseLogger.log("3", null, null, "rfqRs closed");
}
if (rfqPstmt != null) {
rfqPstmt.close();
BaseLogger.log("3", null, null, "rfqPstmt closed");
}
if (rfqDetRs != null) {
rfqDetRs.close();
BaseLogger.log("3", null, null, "rfqDetRs closed");
}
if (rfqDetPstmt != null) {
rfqDetPstmt.close();
BaseLogger.log("3", null, null, "rfqDetPstmt closed");
}
if (conn != null) {
BaseLogger.log("3", null, null, "Closing connection");
conn.close();
BaseLogger.log("3", null, null, "Connection closed successfully");
}
} catch (Exception e) {
BaseLogger.log("3", null, null,
"Exception in finally block : "
+ E12GenericUtility.getStackTrace(e));
}
}
return errString;
}
private String checkNull(String input) {
if (input == null) {
input = "";
}
return input;
}
public static String formatDateTime(LocalDate tranDate, LocalTime tranTime) {
LocalDateTime tranDateTime = LocalDateTime.of(tranDate, tranTime);
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String formattedDateTime = tranDateTime.format(formatter);
return formattedDateTime;
}
public static String dateFormatter(String inputDateString) {
String result = "";
String inputFormat = "yyyy-MM-dd HH:mm:ss";
String outputFormat = "dd/MM/yy HH:mm:ss";
try {
// Parse input date string
SimpleDateFormat inputFormatter = new SimpleDateFormat(inputFormat);
Date date = inputFormatter.parse(inputDateString);
// Format the date in the desired output format
SimpleDateFormat outputFormatter = new SimpleDateFormat(outputFormat);
String outputDateString = outputFormatter.format(date);
System.out.println("Input Date: " + inputDateString);
System.out.println("Formatted Date: " + outputDateString);
result = outputDateString;
} catch (Exception e) {
BaseLogger.log("3", null, null, "Exception in dateFormatter. [" + E12GenericUtility.getStackTrace(e) + "]");
}
return result;
}
}
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