public String loadCustomerOnBlurAjaxData( PartyLovVO lovAttributes, ESupplyGlobalParameters loginBean, String xmlString) throws Exception { StringBuilder finalQry = new StringBuilder(); PreparedStatement pstmt = null; ResultSet rs = null; String invoiceBranch = null; String partyId = ""; Connection connection = null; String whereCond = ""; String invoiceDept = null; String tradeTerms = "NoTradeTerm"; boolean ro = false; String creditLimit = null; String collectParty = null; String stParty = null; String collectCon = null; String stCon = null; String csr = null; String salesPersonId = null; String salesPersonIdNickName = null; String collectType = null; String onBlurSeq = null; String[] onBlurSeqAry = null; try { QueryFields fields = new QueryFields(); finalQry.append(PartyLovQueries.loadCustomerOnBlurAjaxQry); fields.put("BP.DCS_STATUS", "1"); fields.put("PR.DCS_CODE", lovAttributes.getPartyRole()); fields.put("BP.DCS_CODE", lovAttributes.getPartyId()); whereCond = " AND " + QueryBuilderUtil.buildWhereCond(fields); finalQry.append(whereCond); connection = getConnection(); pstmt = connection.prepareStatement(finalQry.toString()); rs = pstmt.executeQuery(); if (rs.next()) { onBlurSeq = lovAttributes.getOnBlurSeq(); partyId = StringUtility.noNull(rs.getString("DCS_CODE")); invoiceBranch = StringUtility.noNull(rs.getString("INVOICE_BRANCH")); invoiceDept = StringUtility.noNull(rs.getString("INVOICE_DEPT")); tradeTerms = StringUtility.noNull(rs.getString("TRADE_TERMS")); creditLimit = StringUtility.noNull(rs.getString("CREDIT_LIMIT")); collectParty = StringUtility.noNull(rs.getString("COLLECT_PARTY")); stParty = StringUtility.noNull(rs.getString("ST_PARTY")); collectCon = StringUtility.noNull(rs.getString("COLLECT_CON")); stCon = StringUtility.noNull(rs.getString("ST_CON")); csr = StringUtility.noNull(rs.getString("CSR")); salesPersonId = StringUtility.noNull(rs.getString("SALESPERSONID")); salesPersonIdNickName = StringUtility.noNull(rs.getString("SALESPERSONIDNICKNAME")); if (!StringUtility.isNullEmpty(onBlurSeq)) { onBlurSeqAry = onBlurSeq.split(","); } if (onBlurSeqAry != null && onBlurSeqAry.length > 0) { for (String onBlurFinalSeq : onBlurSeqAry) { if ("1".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { xmlString += "<invoicebranch>" + invoiceBranch + "</invoicebranch>"; xmlString += "<invoicedept>" + invoiceDept + "</invoicedept>"; } if ("2".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { ro = StringUtility.noNull(rs.getString("RO")).equals("1") ? true : false; xmlString += "<tradeterm>" + tradeTerms + "</tradeterm>"; xmlString += "<ro>" + ro + "</ro>"; } if ("3".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { if (!"0".equals(collectCon) && !"1".equals(collectCon)) { collectType = "1".equals(stCon) ? "Export" : ("2".equals(stCon) ? "Import" : "Both"); } else if (collectParty != "0" && "1" != collectParty) { collectType = "1".equals(stParty) ? "Export" : ("2".equals(stParty) ? "Import" : "Both"); } xmlString += "<collectshipment>" + collectType + "</collectshipment>"; } if ("4".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { xmlString += "<creditlimit>" + creditLimit + "</creditlimit>"; } if ("5".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { String[] csrTeam = csr.split(","); String csrXmlString = ""; if (!StringUtility.isNullEmpty(csrTeam)) { if ("csrAETeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 0) { csrXmlString = csrTeam[0]; } else if ("csrAITeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 1) { csrXmlString = csrTeam[1]; } else if ("csrOETeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 2) { csrXmlString = csrTeam[2]; } else if ("csrOITeam".equals(lovAttributes.getCsrType()) && csrTeam.length > 3) { csrXmlString = csrTeam[3]; } else { if (csrTeam.length > 4) { csrXmlString = csrTeam[4]; } } } xmlString += "<csr>" + csrXmlString + "</csr>"; } if ("6".equals(onBlurFinalSeq) || "0".equals(onBlurFinalSeq)) { String[] salesPerson = getDefaultSalespersonForCustomer(partyId, loginBean.getTerminalId()); salesPersonId = !StringUtility.isNullEmpty(salesPerson) ? salesPerson[0] : ""; salesPersonIdNickName = !StringUtility.isNullEmpty(salesPerson) ? salesPerson[1] : ""; xmlString += "<salespersonid>" + salesPersonId + "</salespersonid>"; xmlString += "<salespersonidnickname>" + salesPersonIdNickName + "</salespersonidnickname>"; } } } } } finally { ConnectionUtil.closeConnection(connection, pstmt, rs); } return xmlString; }