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_Invoice_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 strADOrgID = vars.getStringParameter("inpadOrgId"); 46 String strCInvoiceID = vars.getStringParameter("inpcInvoiceId"); 47 String strWindowId = vars.getStringParameter("inpwindowId"); 48 String strIsSOTrx = Utility.getContext(this, vars, "isSOTrx", strWindowId); 49 String strWharehouse = Utility.getContext(this, vars, "#M_Warehouse_ID", strWindowId); 50 String strTabId = vars.getStringParameter("inpTabId"); 51 52 try { 53 printPage(response, vars, strMProductID, strADOrgID, strCInvoiceID, strIsSOTrx, strWharehouse, strTabId); 54 } catch (ServletException ex) { 55 pageErrorCallOut(response); 56 } 57 } else pageError(response); 58 } 59 60 void printPage(HttpServletResponse response, VariablesSecureApp vars, String strMProductID, String strADOrgID, String strCInvoiceID, String strIsSOTrx, String strWharehouse, String strTabId) throws IOException, ServletException { 61 if (log4j.isDebugEnabled()) log4j.debug("Output: dataSheet"); 62 XmlDocument xmlDocument = xmlEngine.readXmlTemplate("org/openbravo/erpCommon/ad_callouts/CallOut").createXmlDocument(); 63 64 StringBuffer resultado = new StringBuffer (); 65 resultado.append("var calloutName='SL_Invoice_Tax';\n\n"); 66 resultado.append("var respuesta = new Array("); 67 68 SLInvoiceTaxData [] data = SLInvoiceTaxData.select(this, strCInvoiceID); 69 70 String strCTaxID = Tax.get(this, strMProductID, data[0].dateinvoiced, strADOrgID, strWharehouse, data[0].cBpartnerLocationId, data[0].cBpartnerLocationId, data[0].cProjectId, strIsSOTrx.equals("Y")); 71 72 resultado.append("new Array(\"inpcTaxId\", \"" + strCTaxID + "\")"); 73 74 resultado.append(");"); 75 xmlDocument.setParameter("array", resultado.toString()); 76 xmlDocument.setParameter("frameName", "frameAplicacion"); 77 response.setContentType("text/html; charset=UTF-8"); 78 PrintWriter out = response.getWriter(); 79 out.println(xmlDocument.print()); 80 out.close(); 81 } 82 } 83 | Popular Tags |