1 19 package org.openbravo.erpCommon.ad_callouts; 20 21 import org.openbravo.base.secureApp.HttpSecureAppServlet; 22 import org.openbravo.base.secureApp.VariablesSecureApp; 23 import org.openbravo.xmlEngine.XmlDocument; 24 import org.openbravo.erpCommon.utility.Utility; 25 import java.io.*; 26 import javax.servlet.*; 27 import javax.servlet.http.*; 28 29 import org.openbravo.erpCommon.businessUtility.Tax; 30 31 public class SL_Order_Tax extends HttpSecureAppServlet { 32 33 34 public void init (ServletConfig config) { 35 super.init(config); 36 boolHist = false; 37 } 38 39 public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException,ServletException { 40 VariablesSecureApp vars = new VariablesSecureApp(request); 41 if (vars.commandIn("DEFAULT")) { 42 String strChanged = vars.getStringParameter("inpLastFieldChanged"); 43 if (log4j.isDebugEnabled()) log4j.debug("CHANGED: " + strChanged); 44 String strMProductID = vars.getStringParameter("inpmProductId"); 45 String strCBPartnerLocationID = vars.getStringParameter("inpcBpartnerLocationId"); 46 String strDateOrdered = vars.getStringParameter("inpdateordered"); 47 String strADOrgID = vars.getStringParameter("inpadOrgId"); 48 String strMWarehouseID = vars.getStringParameter("inpmWarehouseId"); 49 String strCOrderId = vars.getStringParameter("inpcOrderId"); 50 String strWindowId = vars.getStringParameter("inpwindowId"); 51 String strIsSOTrx = Utility.getContext(this, vars, "isSOTrx", strWindowId); 52 String strTabId = vars.getStringParameter("inpTabId"); 53 54 try { 55 printPage(response, vars, strChanged, strMProductID, strCBPartnerLocationID, strDateOrdered, strADOrgID, strMWarehouseID, strCOrderId, strIsSOTrx, strTabId); 56 } catch (ServletException ex) { 57 pageErrorCallOut(response); 58 } 59 } else pageError(response); 60 } 61 62 void printPage(HttpServletResponse response, VariablesSecureApp vars, String strChanged, String strMProductID, String strCBPartnerLocationID, String strDateOrdered, String strADOrgID, String strMWarehouseID, String strCOrderId, String strIsSOTrx, String strTabId) throws IOException, ServletException { 63 if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); 64 XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument(); 65 66 StringBuffer resultado = new StringBuffer (); 67 resultado.append("var calloutName='SL_Order_Tax';\n\n"); 68 resultado.append("var respuesta = new Array("); 69 70 SLOrderTaxData [] data = SLOrderTaxData.select(this, strCOrderId); 71 72 String strCTaxID=""; 73 if (data!=null && data.length>0){ 74 strCTaxID = Tax.get(this, strMProductID, data[0].dateordered, strADOrgID, strMWarehouseID, (data[0].billtoId.equals("")?strCBPartnerLocationID:data[0].billtoId), strCBPartnerLocationID, data[0].cProjectId, strIsSOTrx.equals("Y")); 75 } 76 resultado.append("new Array(\"inpcTaxId\", " + (strCTaxID.equals("")?"\"\"":strCTaxID) + ")"); 77 78 resultado.append(");"); 79 xmlDocument.setParameter("array", resultado.toString()); 80 xmlDocument.setParameter("frameName", "frameAplicacion"); 81 response.setContentType("text/html; charset=UTF-8"); 82 PrintWriter out = response.getWriter(); 83 out.println(xmlDocument.print()); 84 out.close(); 85 } 86 } 87 | Popular Tags |