message.append(Utility.messageBD(this, "NoBPLocation", vars.getLanguage()));
}
FieldProvider[] tdv = null;
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR",
"C_BPartner_Location_ID", "", "C_BPartner Location - Ship To", Utility.getContext(this,
vars, "#AccessibleOrgTree", strWindowId), Utility.getContext(this, vars,
"#User_Client", strWindowId), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
tdv = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
resultado.append("new Array(\"inpcBpartnerLocationId\", ");
if (tdv != null && tdv.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < tdv.length; i++) {
resultado.append("new Array(\"" + tdv[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(tdv[i].getField("name")) + "\", \""
+ (tdv[i].getField("id").equalsIgnoreCase(strLocation) ? "true" : "false") + "\")");
if (i < tdv.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
resultado.append("\n),");
FieldProvider[] td = null;
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "M_Warehouse_ID",
"", "", Utility.getContext(this, vars, "#AccessibleOrgTree", strWindowId), Utility
.getContext(this, vars, "#User_Client", strWindowId), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
td = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
resultado.append("new Array(\"inpmWarehouseId\", ");
if (td != null && td.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < td.length; i++) {
resultado.append("new Array(\"" + td[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(td[i].getField("name")) + "\", \""
+ (td[i].getField("id").equalsIgnoreCase(strMwarehouse) ? "true" : "false") + "\")");
if (i < td.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
resultado.append("\n),");
resultado.append("new Array(\"inpsalesrepId\", ");
FieldProvider[] tld = null;
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLE", "",
"AD_User SalesRep", "", Utility.getContext(this, vars, "#AccessibleOrgTree",
"SEOrderBPartner"),
Utility.getContext(this, vars, "#User_Client", "SEOrderBPartner"), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, "SEOrderBPartner", "");
tld = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
if (tld != null && tld.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < tld.length; i++) {
resultado.append("new Array(\"" + tld[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(tld[i].getField("name")) + "\", \""
+ (tld[i].getField("id").equalsIgnoreCase(strUserRep) ? "true" : "false") + "\")");
if (i < tld.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
resultado.append("\n),");
FieldProvider[] l = null;
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "",
"C_Order InvoiceRule", "", Utility.getContext(this, vars, "#AccessibleOrgTree",
"SEOrderBPartner"),
Utility.getContext(this, vars, "#User_Client", "SEOrderBPartner"), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, "SEOrderBPartner", "");
l = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
resultado.append("new Array(\"inpinvoicerule\", ");
if (l != null && l.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < l.length; i++) {
resultado.append("new Array(\"" + l[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(l[i].getField("name")) + "\", \""
+ (l[i].getField("id").equalsIgnoreCase(strInvoiceRule) ? "true" : "false") + "\")");
if (i < l.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
resultado.append("\n),");
resultado.append("new Array(\"inpcProjectId\", \"\"),");
resultado.append("new Array(\"inpcProjectId_R\", \"\"),");
FieldProvider[] tlv = null;
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLE", "",
"C_BPartner Location", "C_BPartner Location - Bill To", Utility.getContext(this, vars,
"#AccessibleOrgTree", strWindowId), Utility.getContext(this, vars, "#User_Client",
strWindowId), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
tlv = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
resultado.append("new Array(\"inpbilltoId\", ");
if (tlv != null && tlv.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < tlv.length; i++) {
resultado.append("new Array(\"" + tlv[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(tlv[i].getField("name")) + "\", \""
+ (tlv[i].getField("id").equalsIgnoreCase(strLocation) ? "true" : "false") + "\")");
if (i < tlv.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
resultado.append("\n),");
resultado.append("new Array(\"inppaymentrule\", \"" + strPaymentrule + "\"),");
resultado.append("new Array(\"inpcPaymenttermId\", \""
+ (strPaymentterm.equals("") ? SEOrderBPartnerData.selectPaymentTerm(this, Utility
.getContext(this, vars, "#User_Client", strWindowId)) : strPaymentterm) + "\"),");
resultado.append("new Array(\"inpdeliveryrule\", ");
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "LIST", "",
"C_Order DeliveryRule", "", Utility.getContext(this, vars, "#AccessibleOrgTree",
"SEOrderBPartner"),
Utility.getContext(this, vars, "#User_Client", "SEOrderBPartner"), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, "SEOrderBPartner", "");
l = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}
if (strIsSOTrx.equals("N")) {
resultado.append("\"")
.append(
(strDeliveryRule.equals("") ? ((l != null && l.length > 0) ? l[0].getField("id")
: "null") : strDeliveryRule)).append("\"");
} else {
if (l != null && l.length > 0) {
resultado.append("new Array(");
for (int i = 0; i < l.length; i++) {
resultado.append("new Array(\"" + l[i].getField("id") + "\", \""
+ FormatUtilities.replaceJS(l[i].getField("name")) + "\", \""
+ (l[i].getField("id").equalsIgnoreCase(strDeliveryRule) ? "true" : "false") + "\")");
if (i < l.length - 1)
resultado.append(",\n");
}
resultado.append("\n)");
} else
resultado.append("null");
}
resultado.append("\n),");
try {
ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_User_ID", "",
"AD_User C_BPartner User/Contacts", Utility.getContext(this, vars, "#AccessibleOrgTree",
strWindowId), Utility.getContext(this, vars, "#User_Client", strWindowId), 0);
Utility.fillSQLParameters(this, vars, null, comboTableData, strWindowId, "");
tdv = comboTableData.select(false);
comboTableData = null;
} catch (Exception ex) {
throw new ServletException(ex);
}