Sim Greenbaum
02/16/2022, 10:08 PMal3xicon
02/16/2022, 10:23 PMSim Greenbaum
02/16/2022, 10:25 PM!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
scottvonduhn
02/16/2022, 11:50 PMSim Greenbaum
02/16/2022, 11:52 PMSim Greenbaum
02/16/2022, 11:53 PMscottvonduhn
02/16/2022, 11:55 PMSim Greenbaum
02/16/2022, 11:56 PMscottvonduhn
02/16/2022, 11:57 PMscottvonduhn
02/16/2022, 11:59 PMSim Greenbaum
02/17/2022, 4:17 AMSim Greenbaum
02/17/2022, 4:21 AM<#if record.item?has_content>
<table align="left" class="itemtable" width="100%"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
<tr>
<th colspan="8" style="align: left;">${item.item@label}</th>
<th colspan="9">${item.description@label}</th>
<th colspan="4" style="align: right;">${item.quantity@label}</th>
<th colspan="4" style="align: left;">Country Origin</th>
<th colspan="6" style="align: right;">${item.rate@label}</th>
<th colspan="6" style="align: right;">${item.amount@label}</th>
</tr>
</thead>
</#if><tr style="background-color: ${((item_index % 2)==0)?string('#ffffff', '#f0f0f0')};">
<td colspan="8"><span style="color:#666666;">${item.item}</span></td>
<td colspan="9"><span style="color:#666666;">${item.description}</span></td>
<td colspan="4" style="align: right;"><span style="color:#666666;">${item.quantity}</span></td>
<td colspan="4"><span style="color:#666666;">${item.custcol10}</span></td>
<td colspan="6" style="align: right;"><span style="color:#666666;">${item.lastpurchaseprice}</span></td>
<td colspan="6" style="align: right;"><span style="color:#666666;">$ ${item.quantity*item.lastpurchaseprice}</span></td>
</tr>
</#list><!-- end items --></table>
</#if>
<hr />
<table align="left" border="0" width="100%"><tr>
<td colspan="24"> </td>
<td colspan="6" style="align: right;"><b><span class="total">${record.total@label}</span></b></td>
<td align="right" colspan="7"><b><span class="total">${record.total}</span></b></td>
</tr></table>
scottvonduhn
02/17/2022, 2:10 PMrecord.total
should already give the total of all line amounts. if you want to display a different value, you will need to calculate the sum yourself with a variable.
https://freemarker.apache.org/docs/dgui_misc_var.html
generally:
<#assign t = 0>
<#list record.item as item>
<#assign t = t + (item.quantity * item.lastpurchaseprice)>
</#list>
then display the variable where you want it to show upSim Greenbaum
02/17/2022, 2:34 PMscottvonduhn
02/17/2022, 2:46 PMSim Greenbaum
02/17/2022, 4:05 PMSim Greenbaum
02/17/2022, 4:14 PM${nsformat_rate(total, "USD")}
this still gives more than 2 decimalsscottvonduhn
02/17/2022, 4:16 PMSim Greenbaum
02/17/2022, 4:17 PMTotal $31,527.57352212
scottvonduhn
02/17/2022, 4:18 PMscottvonduhn
02/17/2022, 4:19 PMscottvonduhn
02/17/2022, 4:20 PM${nsformat_currency(32)}
?scottvonduhn
02/17/2022, 4:20 PMscottvonduhn
02/17/2022, 4:21 PMSim Greenbaum
02/17/2022, 4:38 PMscottvonduhn
02/17/2022, 4:51 PM${total?string.currency}
or ${total?string[",##0.00"]}
Sim Greenbaum
02/17/2022, 7:05 PMitem.lastpurchaseprice
scottvonduhn
02/17/2022, 7:15 PM<#assign lpp = item.lastpurchaseprice>
Sim Greenbaum
02/17/2022, 7:16 PMscottvonduhn
02/17/2022, 7:17 PMscottvonduhn
02/17/2022, 7:18 PM<#assign lpp = record.item?first.lastpurchaseprice>
Sim Greenbaum
02/17/2022, 7:18 PMscottvonduhn
02/17/2022, 7:18 PMSim Greenbaum
02/17/2022, 7:19 PM<#assign lpp = <#if item.lastpurchaseprice > 0><#else> item.rate </#if>>
scottvonduhn
02/17/2022, 7:24 PMcondition?then(ifTrue, ifFalse)
directive, and also gt 0
instead of `> 0`: <#assign lpp = (item.lastpurchaseprice gt 0)?then(item.lastpurchaseprice, item.rate)>