是否可以通过基于特定字段的公共值进行分组来将一个大项目表分离为较小的项目表?
例如,如果项目记录有一个名为“Category”的字段,并且列表选项是“Category A”、“Category B”和“Category C”,是否可以将表分成 3 个较小的表?
是否可以通过基于特定字段的公共值进行分组来将一个大项目表分离为较小的项目表?
例如,如果项目记录有一个名为“Category”的字段,并且列表选项是“Category A”、“Category B”和“Category C”,是否可以将表分成 3 个较小的表?
高级 PDF 模板引擎中的语法类似于:
<#iftrue>
<table></table>
<#else>
<table></table>
我建议找到一个与您想要的内容类似的 PDF,然后复制/编辑代码以供您使用。
但是,通过一些练习,我认为您会发现使用 JavaScript 和 XML 创建 PDF 会容易得多。我是从头顶上做的,所以其中一些可能会关闭。如果您需要帮助,或者我犯了错误,请随时与我们联系。
设置是一个用户事件、一个 Suitelet 和一个 XML 文件。
/**
* @NScriptType UserEvent
* @NApiVersion 2.0 // 2.1 if you can
*/
define(["N/anyLibrariesYouNeed"), function(anyLibrariesYouNeed) {
function beforeLoad(context){
if (context.type === "view") {
context.form.addButton({
id: "custpage_print_pdf",
label: "Print PDF",
functionName: 'window.open("link_to_suitelet")'
}
return {beforeLoad: beforeLoad}
})
/**
* @NScriptType Suitelet
* @NApiVersion 2.0 // 2.1 if you can
*/
define(["N/file", "N/search", "N/anyLibrariesYouNeed"], function(file, search, anyLibrariesYouNeed) {
function onRequest(context) {
// Load the PDF, which is just an XML file
var myPDF = file.load("path_to_your PDF").getContents();
// Load the search
var mySearch = search.load({id: "mySearchId"});
// Do some stuff with the results ...
var myResults = [];
mySearch.run.each(function(result){
// ... like generate a </table> or group results with Lodash
})
//Just make sure all the placeholder text in your XML (PDF) file is replaced. If it's not do ...
myPDF = myPDF.replace("Placeholder", "With this");
//Finally, render the PDF from XML using the bigfaceless engine provided by NetSuite. The setup for bigfaceless is in the XML file.
context.response.renderPdf(myPDF);
}
return {onRequest: onRequest}
})
context.response.renderPdf(myPDF)
//big_face_less_tag_goes_here and something like DOCTYPE XML
<pdf>
<head>
<style>
table tr th td {
border: 1px solid black
}
</style>
<body>
Placeholder
</body>
</pdf>
希望有帮助。如果您需要帮助,请大声喊叫!