我不是NetSuite和SuiteScript的新手,我正在绊脚石。
问题:对于每个存款记录,我需要创建一个可打印的pdf文件,其中列出该记录中的每笔付款(银行存款单)。我想在自定义按钮上调用此pdf,以在可以从中打印的新窗口中显示。我不需要将文档保存在文件柜中。
1。。现在,我有一个UserEvent按钮,以查看和编辑模式显示在“存款”上。
define([], function () {
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
var exports = {};
function beforeLoad(context) {
context.form.addButton({
id: "custpage_printdepositslip",
label: "Print Deposit Slip",
functionName: "onButtonClick"
});
context.form.clientScriptModulePath = "SuiteScripts/depositSlips/customDepositSlipButton.js"
}
exports.beforeLoad = beforeLoad;
return exports;
});
2。。此按钮从名为“ customDepositSlipButton.js”的ClientScript中调用clickhandler函数“ onButtonClick”
define(["N/ui/dialog"], function (dialog) {
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
var exports = {};
function pageInit(context) {
// TODO
}
function onButtonClick() {
dialog.alert({
title: "COMING SOON",
message: "This feature will eventually create a bank deposit slip"
});
}
exports.onButtonClick = onButtonClick;
exports.pageInit = pageInit;
return exports;
});
当前这有效,但仅出于测试目的而创建对话框弹出窗口。到目前为止,一切都很好。 testing popup
这就是我要坚持的地方:我现在不知道如何将其连接到Suitelet上的功能,该功能应该从xml生成pdf文件。
3。。我已经在同一文件柜中的标题为“ depositSlipPDF.js”的文件柜中,使用xml脚本中的pdf设置了Suitelet,其功能如下:“ generatePdfFileFromRawXml”。
define(['N/render', 'N/record'],
function(render, record) {
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
* @appliedtorecord deposit
*/
/**
* <code>onRequest</code> event handler
* @gov 0
*
* @param request
* {Object}
* @param response
* {String}
*
* @return {void}
*
* @static
* @function onRequest
*/
function generatePdfFileFromRawXml() {
var xml = '<?xml version="1.0"?>n<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">n<pdf>n<body size="letter-landscape" font-size="10">n';
xml += '<table width="100%" align="center">n';
xml += '<tr>n';
xml += '<td>Deposit Number: ' + depositRecord.getFieldValue('tranid') + '</td>n';
xml += '</tr>n';
xml += '<tr>n';
xml += '<td>Date: ' + depositRecord.getFieldValue('trandate') + '</td>n';
xml += '</tr>n';
xml += '<tr>n';
xml += '<td>Total: ' + depositRecord.getFieldValue('total') + '</td>n';
xml += '</tr>n';
xml += '<tr>n';
xml += '<td>Posting Period: ' + depositRecord.getFieldText('postingperiod') + '</td>n';
xml += '</tr>n';
xml += '</table>n';
xml += '<br /><br />n';
xml += '<table width="100%" align="center">n';
xml += '<thead>n';
xml += '<tr>n';
xml += '<th>Date</th>n';
xml += '<th>ID</th>n';
xml += '<th>Customer</th>n';
xml += '<th>Payment Amount</th>n';
xml += '<th>Transaction Amount</th>n';
xml += '<th>Transaction Type</th>n';
xml += '<th>Payment Method</th>n';
xml += '</tr>n';
xml += '</thead>n';
xml += '<tbody>n';
for (var i = 1; i < parseInt(depositRecord.getLineItemCount('payment')) + 1; i++)
{
if (depositRecord.getLineItemValue('payment', 'deposit', i) == 'T')
{
xml += '<tr>n';
xml += '<td>' + depositRecord.getLineItemValue('payment', 'docdate', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemValue('payment', 'docnumber', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemText('payment', 'entity', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemValue('payment', 'paymentamount', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemValue('payment', 'transactionamount', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemValue('payment', 'type', i) + '</td>n';
xml += '<td>' + depositRecord.getLineItemText('payment', 'paymentmethod', i) + '</td>n';
xml += '</tr>n';
}
}
xml += '</tbody>n';
xml += '</table>n';
xml += '</body>n</pdf>';
var pdfFile = render.xmlToPdf({
xmlString: xmlStr
});
}
return {
onRequest: generatePdfFileFromRawXml
}
});
如何调用generatePdfFileFromRawXml();来自onButtonClick();?
为此付出的努力去了Stoic Software,在这里SS2变得可以理解(谢谢你,埃里克(Eric)),在this post的团队标签中,我正在获取这些初始xml数据提取的代码。 / p>
答案 0 :(得分:2)
使用前面两个答案中的输入,这是完整的解决方案和结果屏幕截图:
第1步)使用客户端脚本为自定义按钮建立点击处理程序,该脚本将获取我当前记录的ID,并将其传递给在新窗口中执行的套间
define(['N/url', 'N/currentRecord'], function (url, currentRecord) {
/**
*
* @NApiVersion 2.x
* @NScriptType ClientScript
* @appliedtorecord deposit
*/
var exports = {};
/**
* <code>pageInit</code> event handler
*
* @gov XXX
*
* @param context
* {Object}
* @param context.mode
* {String} The access mode of the current record. will be one of
* <ul>
* <li>copy</li>
* <li>create</li>
* <li>edit</li>
* </ul>
*
* @return {void}
*
* @static
* @function pageInit
*/
function pageInit(context) {
// TODO
}
function onButtonClick() {
var suiteletUrl = url.resolveScript({
scriptId: 'customscript_depositslip_pdf', //the script id of my suitelet
deploymentId: 'customdeploy_depositslip_pdf', //the deployment id of my suitelet
returnExternalUrl: false,
params: {
custom_id: currentRecord.get().id,
},
});
window.open(suiteletUrl);
}
exports.onButtonClick = onButtonClick;
exports.pageInit = pageInit;
return exports;
});
步骤2)用户事件脚本创建一个自定义按钮,该按钮在我的存款记录的编辑和查看模式下均可见,并从我的客户脚本中调用点击处理程序。
define([], function () {
/**
*
* @NApiVersion 2.x
* @NScriptType UserEventScript
* @appliedtorecord deposit
*/
var exports = {};
/**
* <code>beforeLoad</code> event handler
*
* @gov 0
*
* @param context
* {Object}
* @param context.newRecord
* {record} the new record being loaded
* @param context.type
* {UserEventType} the action that triggered this event
* @param context.form
* {form} The current UI form
*
* @return {void}
*
* @static
* @function beforeLoad
*/
function beforeLoad(context) {
context.form.addButton({
id: "custpage_printdepositslip",
label: "Print Deposit Slip",
functionName: "onButtonClick"
});
context.form.clientScriptModulePath = "SuiteScripts/ss2-add-button/customDepositSlipButton.js"
}
exports.beforeLoad = beforeLoad;
return exports;
});
第3步)Suitelet脚本,用于从xml创建一个相对于当前存款记录ID(单击按钮的位置)的自定义表单,该表单从存款子列表中提取信息,并以pdf格式将其返回到有组织的表格中如果表需要多个页面,则在每个页面上保留的页眉和页脚部分。
define(['N/render', 'N/record', 'N/xml', 'N/format'],
function(render, record, xml, format) {
/**
*@NApiVersion 2.x
* @NScriptType Suitelet
* @appliedtorecord deposit
*/
/**
* <code>onRequest</code> event handler
* @gov 0
*
* @param request
* {Object}
* @param response
* {String}
*
* @return {void}
*
* @static
* @function onRequest
* @function generateXml
*/
function onRequest(context) {
var id = context.request.parameters.custom_id;
if (!id) {
context.response.write('The parameter "custom_id" is required');
return;
}
var xmlString = generateXml(id);
context.response.renderPdf({ xmlString : xmlString });
}
function generateXml(id) {
var depositRecord = record.load({ type: record.Type.DEPOSIT, id: id });
var totes = depositRecord.getValue('total');
var totally = format.format({value:totes, type:format.Type.CURRENCY});
var fulldate = depositRecord.getValue('trandate');
var mmdddate = format.format({value:fulldate, type:format.Type.DATE});
var xml='<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">\n<pdf>\n<head>\n<macrolist>\n<macro id="nlheader">\n';
xml += '<table width="100%" align="center" style="font-size:11px;">\n';
xml += '<tr>\n';
xml += '<td><b>Deposit Number:</b> ' + depositRecord.getValue('tranid') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Date:</b> ' + mmdddate + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Account:</b> ' + depositRecord.getText('account') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Total:</b> ' + totally + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Posting Period:</b> ' + depositRecord.getText('postingperiod') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Memo:</b> ' + depositRecord.getText('memo') + '</td>\n';
xml += '</tr>\n';
xml += '</table>\n';
xml += '</macro>\n<macro id="nlfooter">\n<table style="width: 100%;">\n<tr>\n<td align="right" style="padding: 0; font-size:8pt;">\n<p align="right" text-align="right" ><br /><pagenumber/> of <totalpages/></p>\n</td>\n</tr>\n</table>\n</macro>\n</macrolist>\n</head>\n<body header="nlheader" header-height="13%" footer="nlfooter" footer-height="10pt" padding="0.375in 0.5in 0.5in 0.5in" style="font:10px arial, sans-serif; text-align:left;">\n';
xml += '<table width="100%" align="center" cellpadding="4" cellspacing="0" style="text-align:left; border-left:1px solid #ccc; border-right:1px solid #ccc;">\n';
xml += '<thead>\n';
xml += '<tr style="border:1px solid #ccc; background-color:#efefef;">\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Date</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>ID</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Customer</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Payment Method</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Type</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Ref No.</b></th>\n';
xml += '<th><b>Amount</b></th>\n';
xml += '</tr>\n';
xml += '</thead>\n';
xml += '<tbody>\n';
for (var i = 0; i < parseInt(depositRecord.getLineCount({sublistId: 'payment'})); i++)
{
var amt = depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'paymentamount', line: i});
var payamt = format.format({value:amt, type:format.Type.CURRENCY});
var longdate = depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docdate', line: i});
var shortdate = format.format({value:longdate, type:format.Type.DATE});
if (depositRecord.getSublistText({sublistId: 'payment', fieldId: 'deposit', line: i}) == 'T')
{
xml += '<tr style="border-bottom:1px solid #ccc;">\n';
xml += '<td style="border-right:1px solid #ccc;">' + shortdate + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docnumber', line: i}) + '</td>\n';
var name= depositRecord.getSublistText({sublistId: 'payment', fieldId: 'entity', line: i})
var andName = name.match('&')
if(andName){
var newName = name.replace("&", "&");
xml += '<td style="border-right:1px solid #ccc;">' + newName + '</td>\n';
}
else
xml += '<td style="border-right:1px solid #ccc;">' + name + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistText({sublistId: 'payment', fieldId: 'paymentmethod', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'type', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'refnum', line: i}) + '</td>\n';
xml += '<td align="right" style="text-align:right !important;"><p style="text-align:right !important;">' + payamt + '</p></td>\n';
xml += '</tr>\n';
}
}
xml += '</tbody>\n';
xml += '</table>\n';
xml += '</body>\n</pdf>';
return xml;
}
return {
generateXml:generateXml,
onRequest: onRequest
}
});
我遇到的主要障碍是,许多客户的客户名中都有&符号,而xml则将其解释为运算符,这需要在“实体”子列表字段上进行有条件的&符号处理。另外,xml希望返回更长的日期字段形式,其中包括时间戳,我正在使用变量和N / format模块将日期格式转换为mm / dd / yyyy格式。
所有这些都会在您的存款屏幕上放置一个自定义按钮,标记为“打印存款单”,或者您选择在用户事件脚本中为其添加标签的任何内容。当您单击该按钮时,它应该在新窗口中为您提供pdf表单,如下所示(请注意,出于本演示的目的,潜在的敏感信息已被像素化):
就是这样!我希望这会在将来对其他人有所帮助。
答案 1 :(得分:1)
您的Suitelet将需要接受一个参数,以标识要打印的记录:
function onRequest(context) {
var id = context.request.parameters.custom_id;
if (!id) {
context.response.write('The parameter "custom_id" is required');
return;
}
var xmlString = generateXml(id);
context.response.renderPdf({ xmlString: xmlString });
}
function generateXml(id) {
var depositRecord = record.load({ type: record.Type.DEPOSIT, id: id });
var xml = ...
return xml;
}
然后,客户端脚本可以打开输入当前记录的内部ID的Suitelet页面(确保导入N/url
和N/currentRecord
模块):
function onButtonClick() {
var suiteletUrl = url.resolveScript({
scriptId: 'customscript_printdepositslip', // replace with correct script id
deploymentId: 'customdeploy_printdepositslip', // replace with correct deployment id
returnExternalUrl: false,
params: {
custom_id: currentRecord.get().id,
},
});
window.open(suiteletUrl);
}
免责声明:以上代码未经测试,可能包含语法错误!
答案 2 :(得分:1)
我也正在尝试相同的方法。我的终于可以了,尝试将您的xml字符串更改为:
var xml = '<?xml version="1.0"?>\n<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">\n<pdf>';
xml += '\n<body font-size="18">\n';
xml += '<table width="100%" align="center">\n';
xml += '<tr>\n';
xml += '<td>Deposit Number: ' + depositRecord.getValue({fieldId: 'tranid'}) + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td>Date: ' + depositRecord.getValue({fieldId: 'trandate'}) + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td>Total: ' + depositRecord.getValue({fieldId: 'total'}) + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td>Posting Period: ' + depositRecord.getText({fieldId: 'postingperiod'}) + '</td>\n';
xml += '</tr>\n';
xml += '</table>\n';
xml += '<br /><br />\n';
xml += '<table width="100%" align="center">\n';
xml += '<thead>\n';
xml += '<tr>\n';
xml += '<th>Date</th>\n';
xml += '<th>ID</th>\n';
xml += '<th>Customer</th>\n';
xml += '<th>Payment Amount</th>\n';
xml += '<th>Transaction Amount</th>\n';
xml += '<th>Transaction Type</th>\n';
xml += '<th>Payment Method</th>\n';
xml += '</tr>\n';
xml += '</thead>\n';
xml += '<tbody>\n';
for (var i = 0; i < parseInt(depositRecord.getLineCount({sublistId: 'payment'})); i++){
if (depositRecord.getSublistText({sublistId: 'payment', fieldId: 'deposit', line: i}) == 'T'){
xml += '<tr>\n';
xml += '<td>' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docdate', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docnumber', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistText({sublistId: 'payment', fieldId: 'entity', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'paymentamount', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'transactionamount', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'type', line: i}) + '</td>\n';
xml += '<td>' + depositRecord.getSublistText({sublistId: 'payment', fieldId: 'paymentmethod', line: i}) + '</td>\n';
xml += '</tr>\n';
}
}
xml += '</tbody>\n';
xml += '</table>\n';
xml += '</body>';
xml += '\n</pdf>';
并查看是否可以解决您的解析XML错误。
答案 3 :(得分:0)
我不能停止改善这一点。这是更新的套件代码,修改了我们的&符号替换,以全局替换实体名称中的所有&符号实例(是的,我们有一个带有两个&符号的客户)。
此外,我添加了for循环以显示“其他存款”子列表中的数据以及这些子列表中的一个或两个中都存在数据时的“现金返还”。
define(['N/render', 'N/record', 'N/xml', 'N/format'],
function(render, record, xml, format) {
/**
*@NApiVersion 2.x
* @NScriptType Suitelet
* @appliedtorecord deposit
*/
/**
* <code>onRequest</code> event handler
* @gov 0
*
* @param request
* {Object}
* @param response
* {String}
*
* @return {void}
*
* @static
* @function onRequest
* @function generateXml
*/
function onRequest(context) {
var id = context.request.parameters.custom_id;
if (!id) {
context.response.write('The parameter "custom_id" is required');
return;
}
var xmlString = generateXml(id);
context.response.renderPdf({ xmlString : xmlString });
}
function generateXml(id) {
var depositRecord = record.load({ type: record.Type.DEPOSIT, id: id });
var totes = depositRecord.getValue('total');
var totally = format.format({value:totes, type:format.Type.CURRENCY});
var fulldate = depositRecord.getValue('trandate');
var mmdddate = format.format({value:fulldate, type:format.Type.DATE});
var xml='<?xml version="1.0" encoding="utf-8"?>\n<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">\n<pdf>\n<head>\n<macrolist>\n<macro id="nlheader">\n';
xml += '<table width="100%" align="center" style="font-size:11px;">\n';
xml += '<tr>\n';
xml += '<td><b>Deposit Number:</b> ' + depositRecord.getValue('tranid') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Date:</b> ' + mmdddate + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Account:</b> ' + depositRecord.getText('account') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Total:</b> ' + totally + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Posting Period:</b> ' + depositRecord.getText('postingperiod') + '</td>\n';
xml += '</tr>\n';
xml += '<tr>\n';
xml += '<td><b>Memo:</b> ' + depositRecord.getText('memo') + '</td>\n';
xml += '</tr>\n';
xml += '</table>\n';
xml += '</macro>\n<macro id="nlfooter">\n<table style="width: 100%;">\n<tr>\n<td align="right" style="padding: 0; font-size:8pt;">\n<p align="right" text-align="right" ><br /><pagenumber/> of <totalpages/></p>\n</td>\n</tr>\n</table>\n</macro>\n</macrolist>\n</head>\n<body header="nlheader" header-height="13%" footer="nlfooter" footer-height="10pt" padding="0.375in 0.5in 0.5in 0.5in" style="font:10px arial, sans-serif; text-align:left;">\n';
xml += '<table width="100%" align="center" cellpadding="4" cellspacing="0" style="text-align:left; border-left:1px solid #ccc; border-right:1px solid #ccc;">\n';
xml += '<thead>\n';
xml += '<tr style="border:1px solid #ccc; background-color:#efefef;">\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Date</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>ID</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Customer</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Payment Method</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Type</b></th>\n';
xml += '<th style="border-right:1px solid #ccc;"><b>Ref No.</b></th>\n';
xml += '<th><b>Amount</b></th>\n';
xml += '</tr>\n';
xml += '</thead>\n';
xml += '<tbody>\n';
for (var i = 0; i < parseInt(depositRecord.getLineCount({sublistId: 'payment'})); i++)
{
var amt = depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'paymentamount', line: i});
var payamt = format.format({value:amt, type:format.Type.CURRENCY});
var longdate = depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docdate', line: i});
var shortdate = format.format({value:longdate, type:format.Type.DATE});
if (depositRecord.getSublistText({sublistId: 'payment', fieldId: 'deposit', line: i}) == 'T')
{
xml += '<tr style="border-bottom:1px solid #ccc;">\n';
xml += '<td style="border-right:1px solid #ccc;">' + shortdate + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'docnumber', line: i}) + '</td>\n';
var name= depositRecord.getSublistText({sublistId: 'payment', fieldId: 'entity', line: i})
var andName = name.match('&')
if(andName)
name = name.replace(/&/g, "&");
xml += '<td style="border-right:1px solid #ccc;">' + name + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistText({sublistId: 'payment', fieldId: 'paymentmethod', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'type', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'payment', fieldId: 'refnum', line: i}) + '</td>\n';
xml += '<td align="right" style="text-align:right !important;"><p style="text-align:right !important;">' + payamt + '</p></td>\n';
xml += '</tr>\n';
}
}
for (var i = 0; i < parseInt(depositRecord.getLineCount({sublistId: 'other'})); i++)
{
var amt2 = depositRecord.getSublistValue({sublistId: 'other', fieldId: 'amount', line: i});
var payamt2 = format.format({value:amt2, type:format.Type.CURRENCY});
xml += '<tr style="border-bottom:1px solid #ccc;">\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
var name2= depositRecord.getSublistText({sublistId: 'other', fieldId: 'entity', line: i})
var andName2 = name2.match('&')
if(andName2)
name2 = name2.replace(/&/g, "&");
xml += '<td style="border-right:1px solid #ccc;">' + name2 + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistText({sublistId: 'other', fieldId: 'paymentmethod', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'other', fieldId: 'class', line: i}) + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + depositRecord.getSublistValue({sublistId: 'other', fieldId: 'refnum', line: i}) + '</td>\n';
xml += '<td align="right" style="text-align:right !important;"><p style="text-align:right !important;">' + payamt2 + '</p></td>\n';
xml += '</tr>\n';
}
for (var i = 0; i < parseInt(depositRecord.getLineCount({sublistId: 'cashback'})); i++)
{
var amt3 = depositRecord.getSublistValue({sublistId: 'cashback', fieldId: 'amount', line: i});
var payamt3 = format.format({value:amt3, type:format.Type.CURRENCY});
xml += '<tr style="border-bottom:1px solid #ccc;">\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
var name3= depositRecord.getSublistText({sublistId: 'cashback', fieldId: 'account', line: i})
var andName3 = name3.match('&')
if(andName3)
name3 = name3.replace(/&/g, "&");
xml += '<td style="border-right:1px solid #ccc;">' + name3 + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
xml += '<td style="border-right:1px solid #ccc;">' + '</td>\n';
xml += '<td align="right" style="text-align:right !important;"><p style="text-align:right !important;">' + '(' + payamt3 + ')' + '</p></td>\n';
xml += '</tr>\n';
}
xml += '</tbody>\n';
xml += '</table>\n';
xml += '</body>\n</pdf>';
return xml;
}
return {
generateXml:generateXml,
onRequest: onRequest
}
});