Trying to replicate the default basic check/vouche...
# advancedpdf
d
Trying to replicate the default basic check/voucher form using advancedpdf. The basic form would sum up credits, what I have now is listing them all. Couple questions. 1) How do I find the object model that's available to use? 2) How can I sum credit info by the credit.refnum? Here's the code now that lists everything... <#list check.credit as credit> <tr> <td>${credit.creditdate}</td> <td>${credit.type} #${credit.refnum}</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>&nbsp;</td> <td>-${credit.amount}</td> </tr> </#list>
b
Perhaps this will help: 1. I use a Chrome extension called NetSuite Field Explorer which shows you the entire object you are viewing in the UI. In this case you'd be on a bill payment and then look for the line fields section at the bottom and find your join, likely "credit". If you don't use chrome, you can accomplish the same thing (albeit not as pretty IMO) by adding &xml=T to your url of the record you're viewing in the UI. Again, you need to go to the bottom and find what join you have, likely prefixed "<machine name="credit" ...". Within these groups you can see the field ids you need to reference in your code. 2. I'm newish to advanced pdf, freemarker, and BFO but I'd suspect you could do something like this (you'd need proper table structure for the result but you get the idea):
Copy code
<#assign x = 0>
<#list check.credit as credit>
  <#assign x = x + credit.amount>
</#list>
<td> Sum: ${x}</td>
d
1. Thanks @Ben Goligowski. I do use Netsuite Field Explorer and chrome. In this case using &xml=T actually showed details the field explorer didn't. I'll have to remember to try that in the future. 2. I'm sure this could be better but to help anyone else get started this did at least get things going.
<#assign refnums = []>
<#list check.credit as credit>
<#assign creditrefnum=credit.refnum>
<#if refnums?seq_contains(creditrefnum)>
<#else>
<#assign refnums = refnums + [creditrefnum]>
</#if>
</#list>
<#list refnums as refnum>
<#assign reftotal = 0 >
<#list check.credit as credit>
<#if credit.refnum == refnum>
<#assign reftype = credit.type >
<#assign refdate = credit.creditdate >
<#assign reftotal = reftotal + credit.amount>
</#if>
</#list>
<tr>
<td>${refdate}</td>
<td>${reftype} #${refnum}</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>-${reftotal?string.currency}</td>
</tr>
</#list>