  <br>
  <!--
  <table border=1 cellspacing=1 cellpadding=2 width=1948 style="border: 1px inset;">

  <tr valign=top>
  <td valign=top width=48 class=listheader>No.</td>
  <td valign=top width=380 colspan=2 class=listheader>Main</td>
  <td valign=top width=380 colspan=2 class=listheader>Sub Main</td>
  <td valign=top width=380 colspan=2 class=listheader>Sub</td>
  <td valign=top width=380 colspan=2 class=listheader>Sub-Sub</td>
  <td valign=top width=380 colspan=2 class=listheader>Tri-Sub</td>
  </tr>

  </table>
  -->

  <?
  $prevtrade1="";
  $prevtrade2="";
  $prevtrade3="";
  $prevtrade4="";
  $prevtrade5="";
  ?>

  <? foreach ($trade_list as $mytrade) { ?>

    <? if ($mytrade['tradepkey1']!=$prevtrade1) { ?>

    <table border=1 cellspacing=1 cellpadding=2 width=928 style="border: 1px inset;">
    <tr valign=top>
    <td valign=top width=48 class=listnumber><?=$mytrade['recordno'];?></td>
    <td valign=top width=820 class=listcontent><?=$mytrade['tradecode1'];?> - <?=$mytrade['tradedescription1'];?></td>
    <td valign=top width=60 class=listcontent style="text-align: left;">
    <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
    <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
    <? if ($mytrade['tradepkey2']=="") { ?>
      <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
    <? } ?>
    </td>
    </tr>
    <tr valign=top>
    <td valign=top width=928 colspan=3 class=listcontent>

      <? //if ($mytrade['tradepkey2']!=$prevtrade2) { ?>

      <table border=1 cellspacing=1 cellpadding=2 width=908 style="border: 1px inset;">
      <tr valign=top>
      <td valign=top width=48 class=listnumber><?=$mytrade['recordno'];?></td>
      <td valign=top width=800 class=listcontent><?=$mytrade['tradecode2'];?> - <?=$mytrade['tradedescription2'];?></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <? if ($mytrade['tradepkey3']=="") { ?>
        <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? } ?>
      </td>
      </tr>
      <tr valign=top>
      <td valign=top width=928 colspan=3 class=listcontent>

        <? if ($mytrade['tradepkey3']!=$prevtrade3) { ?>

        <table border=1 cellspacing=1 cellpadding=2 width=888 style="border: 1px inset;">
        <tr valign=top>
        <td valign=top width=48 class=listnumber><?=$mytrade['recordno'];?></td>
        <td valign=top width=780 class=listcontent><?=$mytrade['tradecode3'];?> - <?=$mytrade['tradedescription3'];?></td>
        <td valign=top width=60 class=listcontent style="text-align: left;">
        <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
        <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
        <? if ($mytrade['tradepkey4']=="") { ?>
          <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
        <? } ?>
        </td>
        </tr>
        </table>

        <? } ?>

      </td>
      </tr>
      </table>

      <? //} ?>

    </td>
    </tr>
    </table>

    <? } ?>
   
    <?
    $prevtrade1=$mytrade['tradepkey1'];
    $prevtrade2=$mytrade['tradepkey2'];
    $prevtrade3=$mytrade['tradepkey3'];
    $prevtrade4=$mytrade['tradepkey4'];
    $prevtrade5=$mytrade['tradepkey5'];
    ?>
    
  <? } ?>

  <!--/table-->
