How to hide a record element in HTML using conditional statements

31 views Asked by At

I am creating a picking ticket that is connected to a sales order. In the top section of the line items, there should only be the items showing that can be fulfilled and shipped (meaning, their "Quantity Committed" is 1 or more).

In the bottom section (aka Backordered Items), there should only be items showing that are on backorder (therefore, their "Quantity Committed" is 0).

Everything is working exactly as it should except that the items which can be fulfilled and shipped are showing up under BOTH sections when they should only show up in the top section.

How do I do a conditional statement in the Backordered Items section that hides any items that have a "Quantity Committed" of 1 or more, but still shows any items that have a "Quantity Committed" of 0?

Example: TOP SECTION | Item | Ordered | To Ship | B/O | | -------- | -------- | -------- | -------- | | 176 Ultralight | 2 | 2 | 0 |

BACKORDER SECTION | Item | Ordered | To Ship | B/O | | -------- | -------- | -------- | -------- | | 189 Protractor | 3 | 0 | 3 |

I should also add that if there's a partial shipment (where all but 1 or a few of the items is/are in stock and can be shipped), then the line item needs to show how many items are being shipped and how many remaining items are on backorder in both the top and bottom sections.

Example: TOP SECTION | Item | Ordered | To Ship | B/O | | -------- | -------- | -------- | -------- | | 223 Lamp | 4 | 3 | 1 |

BACKORDER SECTION | Item | Ordered | To Ship | B/O | | -------- | -------- | -------- | -------- | | 223 Lamp | 4 | 3 | 1 |

Here is the code:

<!-- *************************************Item table below**********************************************************************--><#if record.item?has_content>
<table class="itemtable" style="width: 100%; margin-top: 10px;">
   <!-- start items -->
   <#list record.item as item>
   <#if item_index==0>
   <thead>
      <tr>
         <th colspan="4">${item.item@label}</th>
         <th>Shelf</th>
         <th>Ordered</th>
         <th>To Ship</th>
         <th>B/O</th>
         <th>Shipped</th>
      </tr>
   </thead>
   </#if>
   <#if (item.quantitycommitted?string == '0')>
   <#elseif item.itemtype == 'OthCharge'><!--  If none comitted or itemtype is other charge then print nothing, else print whats below-->
   <#else>
   <tr>
      <td colspan="4"><span class="itemname">${item.item}</span><br />${item.description}</td>
      <td>${item.custcol2}</td>
      <td>${item.quantity}</td>
      <td>${item.quantitycommitted}</td>
      <td>${item.quantitybackordered}</td>
      <td>_____</td>
   </tr>
   <!-- </#if> -->
   </#list>
</table>
<!-- *************************************Items BackOrdered**********************************************************************-->
<table class="itemtable" style="width:100%; margin-top:20px;">
   <tr>
      <td align="left" style="font-size:13pt;"><strong>BACKORDERED ITEM(S):</strong></td>
   </tr>
</table>
<table class="itemtable2" style="width: 100%; margin-top: 0px;">
   <thead>
      <tr>
         <th colspan="12">Item</th>
         <!--    <th colspan="3">${record.item[0].options@label}</th> -->
         <th align="right" colspan="4">Ordered</th>
         <th align="right" colspan="4">Shipped</th>
         <th align="right" colspan="4">B/O</th>
         <th align="right" colspan="4">Unit</th>
      </tr>
   </thead>
   <#list record.item as tranline><#if tranline.quantitybackordered?has_content>
   <tr>
      <td colspan="12"><span class="itemname">${tranline.item}</span><br />${tranline.description}</td>
      <!--    <td colspan="3">${tranline.options}</td> -->
      <td align="right" colspan="4">${tranline.quantity}</td>
      <td align="right" colspan="4">${tranline.quantitycommitted}</td>
      <td align="right" colspan="4">${tranline.quantitybackordered}</td>
      <td align="right" colspan="4">${tranline.custcol5}</td>
   </tr>
   </#if></#list>
</table>
<!--********************************************************************End Item Lists*******************************************************--><!--********************************************************************End Item Lists*******************************************************-->
0

There are 0 answers