Freemarker Nested If Statements

We have been using pick, pack, ship since we have a drop ship warehouse. Our original Sales Rep for Netsuite, or this was a default setting, had our picking tickets to show the item.quantitycommitted field. Since I was the only one using the pick, pack, ship properly per Netsuites instructions, some items were being sent to stock versus getting pulled for orders as some of you may know, not marking items picked, will not reset picking ticket status for when more items get received. Long story short I have been working on resolving this issue but introducing the proper way to pick pack ship, however the picking ticket was not reflecting the proper amounts that needed pulled. I got it working, with errors on saving, completely except for if there have been items billed. That is where I am stuck. The following code is what I am trying to use and I get 0 errors while saving or when I preview, however it does not seem to work when I try to generate a picking ticket. I get this error;

“Error

An unexpected error has occurred. Please click here to notify support and provide your contact information.”

<tr>
    <#assign billed=item.quantitybilled>
    <#assign picked=item.quantitypickpackship>
    <#assign committed=item.quantitycommitted>
    <#assign qty=item.quantity>
    <td colspan=”3″><span class=”itemname”>${item.item}</span><br />${item.description}</td>
    <td style=”width: 125px;”>${item.options}</td>
    <td style=”width: 86px;”>${item.quantity}</td>
    <td>${item.quantitypickpackship}</td>
    <td style=”width: 47px; text-align: center;”>${item.units}</td>
    <td><#if billed == “0” >
            <#if picked == “0” >
                ${committed}
            <#else>
                <#if billed == picked >
                        ${committed}
                    <#else>
                        ${(committed-picked)}
                    </#if>
                </#if>
    <#else>
        <#if billed = picked >
                ${committed}
            <#else>
                ${(qty-picked)}
        </#if>
    </#if></td>
    </tr>
Add Comment
1 Answer(s)

Hi,

There are a few things I would take a look at here:

Firstly, if you’re going to be performing arithmetic, it’s probably best to use ?number to make sure everything is a number.

Then you can use == 0 instead of == “0”.

You had an = instead of a == somewhere.

And the whole thing looks a lot simpler if you use elseif.

Let me know if you need any further help.

Thanks,

Chris

<tr>
  <#assign billed=item.quantitybilled?number>
  <#assign picked=item.quantitypickpackship?number>
  <#assign committed=item.quantitycommitted?number>
  <#assign qty=item.quantity?number>
  <td colspan=”3″><span class=”itemname”>${item.item}</span><br />${item.description}</td>
  <td style=”width: 125px;”>${item.options}</td>
  <td style=”width: 86px;”>${item.quantity}</td>
  <td>${item.quantitypickpackship}</td>
  <td style=”width: 47px; text-align: center;”>${item.units}</td>
  <td>
    <#if billed == 0 >
      <#if picked == 0 >
        ${committed}
      <#elseif billed == picked >
        ${committed}
      <#else>
        ${(committed-picked)}
      </#if>
    <#elseif billed == picked >
      ${committed}
    <#else>
      ${(qty-picked)}
    </#if>
  </td>
</tr>
Intermediate Answered 2 days ago.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor