ap.paymentrequest.webui
PaymentRequestSignCO
http://wenku.baidu.com/link?url=ujbT5CHkeC1bAtUn9Nsm_FgVB4k4nAWwwlphukyPGKNoPv5cDjRONWAZmf6RejggMg9onxIg_Rqi_gKKV665EVffofZ3Ds_IdKh9Y3tsKZq
public void PrintPDF(OAPageContext pageContext, OAWebBean webBean,
CLOB xmlClob, String printType,
String paymentRequestId) {
HttpServletResponse response =
(HttpServletResponse)pageContext.getRenderingContext().getServletResponse();
// Set the Output Report File Name and Content Type
String contentDisposition;
String fileName;
try {
if ("INVOICE".equals(printType)) {
fileName = "后补发票";
} else {
fileName = "付款申请";
}
contentDisposition =
"attachment;filename=" + java.net.URLEncoder.encode(fileName,
"UTF-8") +
paymentRequestId + ".pdf";
response.setHeader("Content-Disposition", contentDisposition);
response.setContentType("application/pdf");
Reader inputReader = xmlClob.getCharacterStream();
OADBTransactionImpl oaTrans =
(OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction();
String templateName = "";
if ("CON".equals(printType)) {
templateName = "XVK_NO_CNT_PAYMENT_REQUEST";
} else if ("INVOICE".equals(printType)) {
templateName = "XVK_ADD_INV_PAYMENT_REQUEST";
} else {
templateName = "XVK_CONTRACT_PAYMENT_REQUEST";
}
TemplateHelper.processTemplate(oaTrans.getAppsContext(), "XVK",
templateName, "zh", "CN",
inputReader,
TemplateHelper.OUTPUT_TYPE_PDF,
null, response.getOutputStream());
response.getOutputStream().flush();
response.getOutputStream().close();
} catch (Exception e) {
response.setContentType("text/html");
throw new OAException(e.getMessage(), OAException.ERROR);
}
pageContext.setDocumentRendered(false);
}