scott, do you know why the statement above would c...
# advancedpdf
p
scott, do you know why the statement above would cause an error in advanced pdf? should I open a ticket with netsuite for the issue?
s
what is the code causing an error?
p
this code
<td colspan="3"><#if ((.now?long - line.duedate?date("MM/dd/yyyy")?long) / 86400000)?round gte 0> ${((.now?long - line.duedate?date("MM/dd/yyyy")?long) / 86400000)?round} </#if> </td>
s
This may require Netsuite assistance. it appears that the line.duedate is not recognized by FreeMarker as a date or a string. I attempted to force it to a string using line.duedate?string, and it gives an error.
p
thanks
s
for whatever reason, the following works, but combining it into fewer lines was giving me an error
Copy code
<td colspan="3">
  <#assign due = line.duedate?string>
  <#if due != "">
    <#assign duedate = due?date("MM/d/yyyy")>
    <#if .now?date gt duedate>
      <#assign msperday = 86400000>
      ${((.now?date?long - duedate?long) / msperday)?floor}
    </#if>
  </#if>
</td>
Also, for me, the date format had to be "MM/d/yyyy". I don't know why the months have leading zeroes, but the days don't in our environment.
Some lines, like the Balance Forward line, won't have a due date, which is why the empty string check is needed as a first step. That may have been part of what was causing the errors.
Actually, this version is probably better. The msperday could be lifted out of the list loop, since it is a constant
Copy code
<td colspan="3">
  <#assign due = line.duedate?string>
  <#if due != "">
    <#assign msperday = 86400000>
    <#assign duedate = due?date("MM/d/yyyy")>
    <#assign daysoverdue = ((.now?date?long - duedate?long) / msperday)?floor>
    <#if daysoverdue gt 0>${daysoverdue}</#if>
  </#if>
</td>
p
thank you so much
s
you're welcome. I just happened to be fixing some other issues with our statement template, and thought i'd experiment
p
one other question. do you calculate transaction type on the customer statement? we are trying to do a running total of invoices and credit memos in a separate field