  <br>

  <table border=1 cellspacing=1 cellpadding=2 width=928 style="border: 1px inset;">
  <form action="controllers/inputController.php" method="post" name="mblform" id="mblform">

  <tr valign=top>
  <td valign=top width=48 class=listheader>ITEM</td>
  <td valign=top width=100 class=listheader>PROD.CODE</td>
  <td valign=top width=200 class=listheader>MATERIAL NAME</td>
  <td valign=top width=200 class=listheader>DESCRIPTION</td>
  <td valign=top width=100 class=listheader>QTY</td>
  <td valign=top width=100 class=listheader>RATE</td>
  <td valign=top width=100 class=listheader>AMOUNT</td>
  <td valign=top width=60 class=listheader>OPTIONS</td>
  </tr>

  <? $prevsub=""; ?>
  <? $myno=0; ?>
  <? $mysubno=0; ?>

  <? foreach ($mbl_list as $mymbl) { ?>

    <? //if ($mymbl['item_subtradepkey']!=$prevsub) { ?>

      <? $subtotal=$mymblModel->gettotal_mblsubtrade($pubprojectpkey, $mymbl['item_subtradepkey']); ?>
      <? $prevsub=$mymbl['item_subtradepkey']; ?>
      <? $myno++; ?>
      <? $mysubno=0; ?>
      <? $mycolor="#f0f0f0"; ?>

      <? //if ($mymbl['item_level']=="4") { ?>
        <tr valign=top>
        <td valign=top width=48 class=listnumber style="background: <?=$mycolor;?>;"><?=$myno;?>&nbsp;</td>
        <td valign=top width=100 class=listcontent style="background: <?=$mycolor;?>;"><?=stripslashes($mymbl['parentcode']);?>&nbsp;</td>
        <td valign=top width=200 class=listcontent style="background: <?=$mycolor;?>;"><?=stripslashes($mymbl['parentdesc']);?>&nbsp;</td>
        <td valign=top width=200 class=listcontent style="background: <?=$mycolor;?>;">&nbsp;</td>
        <td valign=top width=100 class=listcontent style="background: <?=$mycolor;?>;">&nbsp;</td>
        <td valign=top width=100 class=listcontent style="background: <?=$mycolor;?>;">&nbsp;</td>
        <td valign=top width=100 class=listcontentnumeric style="background: <?=$mycolor;?>;"><?=number_format($subtotal,2);?>&nbsp;</td>
        <td valign=top width=60 class=listcontent style="background: <?=$mycolor;?>;">&nbsp;</td>
        </tr>
      <? //} else if ($mymbl['item_level']=="3") { ?>
        <tr valign=top>
        <td valign=top width=48 class=listnumber style="background: <?=$mycolor;?>;"><?=$myno;?>&nbsp;</td>
        <td valign=top width=100 class=listcontent style="background: <?=$mycolor;?>;"><?=stripslashes($mymbl['item_code']);?>&nbsp;</td>
        <td valign=top width=200 class=listcontent style="background: <?=$mycolor;?>;"><?=stripslashes($mymbl['item_description']);?>&nbsp;</td>
        <td valign=top width=200 class=listcontent style="background: <?=$mycolor;?>;">&nbsp;</td>
        <td valign=top width=100 class=listcontentnumeric style="background: <?=$mycolor;?>;"><?=number_format($mymbl['item_quantity'],4);?>&nbsp;</td>
        <td valign=top width=100 class=listcontentnumeric style="background: <?=$mycolor;?>;"><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
        <td valign=top width=100 class=listcontentnumeric style="background: <?=$mycolor;?>;"><?=number_format($subtotal,2);?>&nbsp;</td>
        <td valign=top width=60 class=listcontent style="background: <?=$mycolor;?>;">
        <? //if (($pubuseraccess['access_mbl_edit']==1)||($pubuserrole>=2)) { ?>
          <a href="index.php?module=mbl&task=edit&itemid=<?=$mymbl['item_pkey'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
          <a href="index.php?module=mbl&task=delete&itemid=<?=$mymbl['item_pkey'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
        <? //} ?>&nbsp;
        </td>
        </tr>
      <? //} ?>

    <? //} ?>

    <? $mysubno++; ?>

    <? //if ($mymbl['item_level']=="4") { ?>
      <tr valign=top>
      <td valign=top width=48 class=listnumber><?=$myno;?>.<?=$mysubno;?>&nbsp;</td>
      <td valign=top width=100 class=listcontent><?=stripslashes($mymbl['item_code']);?>&nbsp;</td>
      <td valign=top width=200 class=listcontent>&nbsp;</td>
      <td valign=top width=200 class=listcontent><?=stripslashes($mymbl['item_description']);?>&nbsp;</td>
      <td valign=top width=100 class=listcontentnumeric><?=number_format($mymbl['item_quantity'],4);?>&nbsp;</td>
      <td valign=top width=100 class=listcontentnumeric><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
      <td valign=top width=100 class=listcontentnumeric><?=number_format($mymbl['item_amount'],2);?>&nbsp;</td>
      <td valign=top width=60 class=listcontent>
      <? //if (($pubuseraccess['access_mbl_edit']==1)||($pubuserrole>=2)) { ?>
	  
        <a href="index.php?module=mbl&task=edit&itemid=<?=$mymbl['item_pkey'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
        <a href="index.php?module=mbl&task=delete&itemid=<?=$mymbl['item_pkey'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? //} ?>&nbsp;
      </td>
      </tr>
    <? //} ?>

  <? } ?>
 <? //test
 echo "<button name=\"add\" id=\"add\" onClick=\"mbl_button_add();\"><img src='gfx/options/b_add.png' class='actionbutton'>&nbsp;&nbsp;Add MBL Item</button>&nbsp;";
?>
  <input name="userpkey" id="userpkey" type="hidden" value="<?=$_SESSION['Xuserpkey'];?>">
  <input name="officername" id="officername" type="hidden" value="<?=$_SESSION['Xstaffname'];?>">
  <input name="date" id="date" type="hidden" value="<?=unconverttounixslash(gettimestamp());?>">
  <input name="status" id="status" type="hidden" value="1">
  <input name="remarks" id="remarks" type="hidden" value="">
  <input name="job" id="job" type="hidden" value="">

  </form>
  </table>
