  <br>

  <!-- NOTE: for budgeted material, later get data from budget table! -->

  <table border=0 cellspacing=0 cellpadding=0 width=928 class=mbltable>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tabletitle>
  Budgeted Material
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=48 class=tableheader>Item</td>
  <td valign=top width=100 class=tableheader>Prod. Code</td>
  <td valign=top width=200 class=tableheader>Material Name</td>
  <td valign=top width=230 class=tableheader>Description</td>
  <td valign=top width=130 class=tableheader>Qty</td>
  <td valign=top width=100 class=tableheader>Rate</td>
  <td valign=top width=120 class=tableheader>Amount</td>
  </tr>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tablecontent>
    <table border=0 cellspacing=0 cellpadding=0 width=920>
    <? $bmcount=0; ?>
    <? $prevsub=""; ?>
    <? $myno=0; ?>
    <? $mysubno=0; ?>
    <? foreach ($mbl_list as $mymbl) { ?>

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

        <?
        $bmcount++;
        if ($bmcount==2) {	//>1) {
          echo "<tr valign=top>";
          echo "<td valign=top colspan=7 class=tableitem>";
          echo "<hr size=1 style='color: black;'>";
          echo "</td>";
          echo "</tr>";
        }
        ?>

        <? $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=tableitemnumber><?=$myno;?>&nbsp;&nbsp;&nbsp;</td>
          <td valign=top width=100 class=tableitem><?=stripslashes($mymbl['parentcode']);?>&nbsp;</td>
          <td valign=top width=200 class=tableitem><?=stripslashes($mymbl['parentdesc']);?>&nbsp;</td>
          <td valign=top width=230 class=tableitem>&nbsp;</td>
          <td valign=top width=130 class=tableitem>&nbsp;</td>
          <td valign=top width=100 class=tableitem>&nbsp;</td>
          <td valign=top width=120 class=tableitemnumeric><?=number_format($subtotal,2);?>&nbsp;</td>
          </tr>
        <? } else if ($mymbl['item_level']=="3") { ?>
          <tr valign=top>
          <td valign=top width=48 class=tableitemnumber><?=$myno;?>&nbsp;&nbsp;&nbsp;</td>
          <td valign=top width=100 class=tableitem><?=stripslashes($mymbl['item_code']);?>&nbsp;</td>
          <td valign=top width=200 class=tableitem><?=stripslashes($mymbl['item_description']);?>&nbsp;</td>
          <td valign=top width=230 class=tableitem>&nbsp;</td>
          <td valign=top width=130 class=tableitemnumeric><?=number_format($mymbl['item_quantity'],4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
          <td valign=top width=100 class=tableitemnumeric><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
          <td valign=top width=120 class=tableitemnumeric><?=number_format($subtotal,2);?>&nbsp;</td>
          </tr>

          <? // get mro item totals for lumpsum budget
          $lastsubsub="";
          $lastrecno=0;
          $lastcode="";
          $lastdesc="";
          $mroitemsubquantity=0;
          $mroitemtotalquantity=0;
          $mro_items = $mymroModel->getlist_mroitemsbysubtrade($pubprojectpkey, $mymbl['item_subtradepkey']);
          foreach ($mro_items as $mroitem) {
            $lastrecno++;
            if ($lastrecno==1) {
              echo "<tr valign=top>";
              echo "<td valign=top colspan=7 class=tableitem>";
              echo "<hr size=1 style='color: black;'>";
              //echo "<img src='pixel.gif' style='color: black; width: 920px; height: 1px;'>";
              echo "</td>";
              echo "</tr>";
            }
            $mroitemsubtotal=$mroitem['item_quantity'] * $mymbl['item_rate'];
            $mroitemtotalquantity += $mroitem['item_quantity'];
            if ($mroitem['item_quantity']>0) {
              ?>
              <tr valign=top>
              <td valign=top width=48 class=tableitemnumber style="color: #0000ff;"><!--<?=$myno;?>.<?=$lastrecno;?>-->&nbsp;&nbsp;&nbsp;</td>
              <td valign=top width=100 class=tableitem style="color: #0000ff;"><?=stripslashes($mroitem['item_code']);?>&nbsp;</td>
              <td valign=top width=200 class=tableitem>&nbsp;<?php //echo $mroitem['item_mropkey'];?></td>
              <td valign=top width=230 class=tableitem style="color: #0000ff;"><?=stripslashes($mroitem['item_description']);?>&nbsp;</td>
              <td valign=top width=130 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mroitem['item_quantity'],4);?> <?=$mroitem['item_unit'];?>&nbsp;</td>
              <td valign=top width=100 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
              <td valign=top width=120 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mroitemsubtotal,2);?>&nbsp;</td>
              </tr>
              <?
            }
          }
          ?>
          <? if ($mroitemtotalquantity>0) { ?>
            <? $mroitemtotalbalance = $mymbl['item_quantity'] - $mroitemtotalquantity; ?>
            <!--<tr valign=top>
            <td valign=top colspan=7 class=tableitem>
            <hr size=1 style='color: black;'>
            </td>
            </tr>-->
            <tr valign=top>
            <td valign=top width=48 class=tableitemnumber style="background: #f0f0f0;">&nbsp;&nbsp;&nbsp;</td>
            <td valign=top width=100 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=200 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=230 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=130 class=tableitemnumeric style="background: #f0f0f0; border-top: 1px solid black; border-bottom: 3px double black;"><?=number_format($mroitemtotalbalance,4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
            <td valign=top width=100 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=120 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
            </tr>
            <tr valign=top>
            <td valign=top colspan=7 class=tableitem>
            <hr size=1 style='color: black;'>
            </td>
            </tr>
          <? } else { ?>
            <tr valign=top>
            <td valign=top width=48 class=tableitemnumber style="background: #f0f0f0;">&nbsp;&nbsp;&nbsp;</td>
            <td valign=top width=100 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=200 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=230 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=130 class=tableitemnumeric style="background: #f0f0f0; border-top: 1px solid black; border-bottom: 3px double black;""><?=number_format($mymbl['item_quantity'],4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
            <td valign=top width=100 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
            <td valign=top width=120 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
            </tr>
          <? } ?>

        <? } ?>

      <? } ?>

      <? $mysubno++; ?>

      <? if ($mymbl['item_level']=="4") { ?>
        <tr valign=top>
        <td valign=top width=48 class=tableitemnumber><?=$myno;?>.<?=$mysubno;?>&nbsp;&nbsp;&nbsp;</td>
        <td valign=top width=100 class=tableitem><?=stripslashes($mymbl['item_code']);?>&nbsp;</td>
        <td valign=top width=200 class=tableitem>&nbsp;<?php //echo $mroitem['item_mropkey'];?></td>
        <td valign=top width=230 class=tableitem><?=stripslashes($mymbl['item_description']);?>&nbsp;</td>
        <td valign=top width=130 class=tableitemnumeric><?=number_format($mymbl['item_quantity'],4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
        <td valign=top width=100 class=tableitemnumeric><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
        <td valign=top width=120 class=tableitemnumeric><?=number_format($mymbl['item_amount'],2);?>&nbsp;</td>
        </tr>

        <? // get mro item totals for lumpsum budget
        $lastsubsub="";
        $lastrecno=0;
        $lastcode="";
        $lastdesc="";
        $mroitemsubquantity=0;
        $mroitemtotalquantity=0;
        $mro_items = $mymroModel->getlist_mroitemsbysubsubtrade($pubprojectpkey, $mymbl['item_subsubtradepkey']);
        foreach ($mro_items as $mroitem) {
          $lastrecno++;
          if ($lastrecno==1) {
            echo "<tr valign=top>";
            echo "<td valign=top colspan=7 class=tableitem>";
            echo "<hr size=1 style='color: black;'>";
            echo "</td>";
            echo "</tr>";
          }
          $mroitemsubtotal=$mroitem['item_quantity'] * $mymbl['item_rate'];
          $mroitemtotalquantity += $mroitem['item_quantity'];
          if ($mroitem['item_quantity']>0) {
            ?>
            <tr valign=top>
            <td valign=top width=48 class=tableitemnumber style="color: #0000ff;"><!--<?=$myno;?>.<?=$mysubno;?>.<?=$lastrecno;?>-->&nbsp;&nbsp;&nbsp;</td>
            <td valign=top width=100 class=tableitem style="color: #0000ff;"><?=stripslashes($mroitem['item_code']);?>&nbsp;</td>
            <td valign=top width=200 class=tableitem style="color: #0000ff;">&nbsp;<?php //echo $mroitem['item_mropkey'];?></td>
            <td valign=top width=230 class=tableitem style="color: #0000ff;"><?=stripslashes($mroitem['item_description']);?>&nbsp;</td>
            <td valign=top width=130 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mroitem['item_quantity'],4);?> <?=$mroitem['item_unit'];?>&nbsp;</td>
            <td valign=top width=100 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mymbl['item_rate'],2);?>&nbsp;</td>
            <td valign=top width=120 class=tableitemnumeric style="color: #0000ff;"><?=number_format($mroitemsubtotal,2);?>&nbsp;</td>
            </tr>
            <?
          }
        }
        ?>
        <? if ($mroitemtotalquantity>0) { ?>
          <? $mroitemtotalbalance = $mymbl['item_quantity'] - $mroitemtotalquantity; ?>
          <!--<tr valign=top>
          <td valign=top colspan=7 class=tableitem>
          <hr size=1 style='color: black;'>
          </td>
          </tr>-->
          <tr valign=top>
          <td valign=top width=48 class=tableitemnumber style="background: #f0f0f0;">&nbsp;&nbsp;&nbsp;</td>
          <td valign=top width=100 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=200 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=230 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=130 class=tableitemnumeric style="background: #f0f0f0; border-top: 1px solid black; border-bottom: 3px double black;""><?=number_format($mroitemtotalbalance,4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
          <td valign=top width=100 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=120 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
          </tr>
          <tr valign=top>
          <td valign=top colspan=7 class=tableitem>
          <hr size=1 style='color: black;'>
          </td>
          </tr>
        <? } else { ?>
          <tr valign=top>
          <td valign=top width=48 class=tableitemnumber style="background: #f0f0f0;">&nbsp;&nbsp;&nbsp;</td>
          <td valign=top width=100 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=200 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=230 class=tableitem style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=130 class=tableitemnumeric style="background: #f0f0f0; border-top: 1px solid black; border-bottom: 3px double black;""><?=number_format($mymbl['item_quantity'],4);?> <?=$mymbl['item_unit'];?>&nbsp;</td>
          <td valign=top width=100 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
          <td valign=top width=120 class=tableitemnumeric style="background: #f0f0f0;">&nbsp;</td>
          </tr>
        <? } ?>

      <? } ?>

    <? } ?>
    </table>
  </td>
  </tr>
  </table>
  <br>
  <!--<button name="viewmro1" id="viewmro1" onClick="mbl_button_viewmro(1);" style="width: 240px;"><img src="gfx/options/b_view.png" class="actionbutton">&nbsp;&nbsp;View Normal MROs</button>&nbsp;-->
  <? if (($pubuseraccess['access_mbl_edit']==1)||($pubuserrole>=2)) { ?>
    <? //aku edit if ($last_approval['approval_type']!="3") { ?>
      <button name="editbudget" id="editbudget" onClick="mbl_button_editbudget();" style="width: 150px;"><img src="gfx/options/b_edit.png" class="actionbutton">&nbsp;&nbsp;Edit Budget</button>&nbsp;
    <? //aku edit} ?>
  <? } ?>
  <hr size=1>

  <br>

  <table border=0 cellspacing=0 cellpadding=0 width=928 class=mbltable>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tabletitle>
  Budgeted Material Exceeded
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=48 class=tableheader>Item</td>
  <td valign=top width=100 class=tableheader>Prod. Code</td>
  <td valign=top width=200 class=tableheader>Material Name</td>
  <td valign=top width=230 class=tableheader>Description</td>
  <td valign=top width=130 class=tableheader>Qty</td>
  <td valign=top width=100 class=tableheader>Rate</td>
  <td valign=top width=120 class=tableheader>Amount</td>
  </tr>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tablecontent>
    <table border=0 cellspacing=0 cellpadding=0 width=920>
    <? $bmecount=0; ?>
    <? foreach ($bme_list as $mybme) { ?>
      <?
      $bmecount++;
      if ($bmecount>1) {
        echo "<tr valign=top>";
        echo "<td valign=top colspan=7 class=tableitem>";
        echo "<hr size=1 style='color: black;'>";
        echo "</td>";
        echo "</tr>";
      }
      // get trade/amount info
      $trade_data=$mytradeModel->getdata_trade($mybme['mro_subtradepkey']);
      $total_amount=$mymroModel->gettotal_mroitems($mybme['mro_pkey']);
      ?>
      <tr valign=top>
      <td valign=top width=48 class=tableitemnumber><?=$bmecount;?>&nbsp;&nbsp;&nbsp;</td>
      <td valign=top width=100 class=tableitem><?=stripslashes($trade_data['tradecode']);?>&nbsp;</td>
      <td valign=top width=200 class=tableitem><?=stripslashes($trade_data['tradedescription']);?>&nbsp;</td>
      <td valign=top width=230 class=tableitem>&nbsp;</td>
      <td valign=top width=130 class=tableitem style="text-align: center;">&nbsp;</td>
      <td valign=top width=100 class=tableitemnumeric>&nbsp;</td>
      <td valign=top width=120 class=tableitemnumeric><?=number_format($total_amount,2);?>&nbsp;</td>
      </tr>
      <?
      $bmeitemcount=0;
      // get trade/items info
      $item_list = $mymroModel->getlist_mroitems($mybme['mro_pkey']);
      foreach ($item_list as $myitem) {
        $bmeitemcount++;
        $trade_data=$mytradeModel->getdata_trade($myitem['item_subsubtradepkey']);
        ?>
        <tr valign=top>
        <td valign=top width=48 class=tableitemnumber><?=$bmecount;?>.<?=$bmeitemcount;?>&nbsp;&nbsp;&nbsp;</td>
        <td valign=top width=100 class=tableitem><?=stripslashes($trade_data['tradecode']);?>&nbsp;</td>
        <td valign=top width=200 class=tableitem>&nbsp;<?php //echo $myitem['item_mropkey'];?></td>
        <td valign=top width=230 class=tableitem><?=stripslashes($trade_data['tradedescription']);?>&nbsp;</td>
        <td valign=top width=130 class=tableitemnumeric style="text-align: center;"><?=number_format($myitem['item_quantity'],4);?> <?=$myitem['item_unit'];?>&nbsp;</td>
        <td valign=top width=100 class=tableitemnumeric><?=number_format($myitem['item_rate'],2);?>&nbsp;</td>
        <td valign=top width=120 class=tableitemnumeric><?=number_format(($myitem['item_quantity']*$myitem['item_rate']),2);?>&nbsp;</td>
        </tr>
      <? } ?>
    <? } ?>
    </table>
  </td>
  </tr>
  </table>
  <br>
  <!--<button name="viewmro2" id="viewmro2" onClick="mbl_button_viewmro(2);" style="width: 240px;"><img src="gfx/options/b_view.png" class="actionbutton">&nbsp;&nbsp;View Variance MROs</button>&nbsp;-->
  <hr size=1>

  <br>

  <table border=0 cellspacing=0 cellpadding=0 width=928 class=mbltable>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tabletitle>
  Non Budgeted Material - VO
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=48 class=tableheader>Item</td>
  <td valign=top width=100 class=tableheader>Prod. Code</td>
  <td valign=top width=200 class=tableheader>Material Name</td>
  <td valign=top width=230 class=tableheader>Description</td>
  <td valign=top width=130 class=tableheader>Qty</td>
  <td valign=top width=100 class=tableheader>Rate</td>
  <td valign=top width=120 class=tableheader>Amount</td>
  </tr>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tablecontent>
    <table border=0 cellspacing=0 cellpadding=0 width=920>
    <? $nbmvocount=0; ?>
    <? foreach ($nbmvo_list as $mynbmvo) { ?>
      <?
      $nbmvocount++;
      if ($nbmvocount>1) {
        echo "<tr valign=top>";
        echo "<td valign=top colspan=7 class=tableitem>";
        echo "<hr size=1 style='color: black;'>";
        echo "</td>";
        echo "</tr>";
      }
      // get trade/amount info
      $trade_data=$mytradeModel->getdata_trade($mynbmvo['mro_subtradepkey']);
      $total_amount=$mymroModel->gettotal_mroitems($mynbmvo['mro_pkey']);
      ?>
      <tr valign=top>
      <td valign=top width=48 class=tableitemnumber><?=$nbmvocount;?>&nbsp;&nbsp;&nbsp;</td>
      <td valign=top width=100 class=tableitem><?=stripslashes($trade_data['tradecode']);?>&nbsp;</td>
      <td valign=top width=200 class=tableitem><?=stripslashes($trade_data['tradedescription']);?>&nbsp;</td>
      <td valign=top width=230 class=tableitem>&nbsp;</td>
      <td valign=top width=130 class=tableitem style="text-align: center;">&nbsp;</td>
      <td valign=top width=100 class=tableitemnumeric>&nbsp;</td>
      <td valign=top width=120 class=tableitemnumeric><?=number_format($total_amount,2);?>&nbsp;</td>
      </tr>
      <?
      $nbmvoitemcount=0;
      // get trade/items info
      $item_list = $mymroModel->getlist_mroitems($mynbmvo['mro_pkey']);
      foreach ($item_list as $myitem) {
        $nbmvoitemcount++;
        $trade_data=$mytradeModel->getdata_trade($myitem['item_subsubtradepkey']);
        ?>
        <tr valign=top>
        <td valign=top width=48 class=tableitemnumber><?=$nbmvocount;?>.<?=$nbmvoitemcount;?>&nbsp;&nbsp;&nbsp;</td>
        <td valign=top width=100 class=tableitem><?//=stripslashes($trade_data['tradecode']);?>
		<?php
		$sql1 = "SELECT item_code from mro_items WHERE item_subsubtradepkey = '".$myitem['item_subsubtradepkey']."'";
		 $query1 = mysql_query($sql1);
		 $show1 = mysql_fetch_assoc($query1);
		 echo stripslashes($show1['item_code']);
		
		?>
		</td>
        <td valign=top width=200 class=tableitem>&nbsp;<?php// echo $myitem['item_mropkey'];?>
												<?php //echo $myitem['item_subsubtradepkey']; ?>
												</td>
        <td valign=top width=230 class=tableitem>
		<?//=stripslashes($trade_data['tradedescription']);?>
		<?php
		 $sql = "SELECT item_description from mro_items WHERE item_subsubtradepkey = '".$myitem['item_subsubtradepkey']."'";
		 $query = mysql_query($sql);
		 $show = mysql_fetch_assoc($query);
		 echo stripslashes($show['item_description']);
		
		?>
		</td>
        <td valign=top width=130 class=tableitemnumeric style="text-align: center;"><?=number_format($myitem['item_quantity'],4);?> <?=$myitem['item_unit'];?>&nbsp;</td>
        <td valign=top width=100 class=tableitemnumeric><?=number_format($myitem['item_rate'],2);?>&nbsp;</td>
        <td valign=top width=120 class=tableitemnumeric><?=number_format(($myitem['item_quantity']*$myitem['item_rate']),2);?>&nbsp;</td>
        </tr>
      <? } ?>
    <? } ?>
    </table>
  </td>
  </tr>
  </table>
  <br>
  <!--<button name="viewmro3" id="viewmro3" onClick="mbl_button_viewmro(3);" style="width: 240px;"><img src="gfx/options/b_view.png" class="actionbutton">&nbsp;&nbsp;View Variance MROs - VO</button>&nbsp;-->
  <hr size=1>

  <br>

  <table border=0 cellspacing=0 cellpadding=0 width=928 class=mbltable>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tabletitle>
  Non Budgeted Material - SubCon
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=48 class=tableheader>Item</td>
  <td valign=top width=100 class=tableheader>Prod. Code</td>
  <td valign=top width=200 class=tableheader>Material Name</td>
  <td valign=top width=230 class=tableheader>Description</td>
  <td valign=top width=130 class=tableheader>Qty</td>
  <td valign=top width=100 class=tableheader>Rate</td>
  <td valign=top width=120 class=tableheader>Amount</td>
  </tr>
  <tr valign=top>
  <td valign=top width=928 colspan=7 class=tablecontent>
    <table border=0 cellspacing=0 cellpadding=0 width=920>
    <? $nbmsccount=0; ?>
    <? foreach ($nbmsc_list as $mynbmsc) { ?>
      <?
      $nbmsccount++;
      if ($nbmsccount>1) {
        echo "<tr valign=top>";
        echo "<td valign=top colspan=7 class=tableitem>";
        echo "<hr size=1 style='color: black;'>";
        echo "</td>";
        echo "</tr>";
      }
      // get trade/amount info
      $trade_data=$mytradeModel->getdata_trade($mynbmsc['mro_subtradepkey']);
      $total_amount=$mymroModel->gettotal_mroitems($mynbmsc['mro_pkey']);
      ?>
      <tr valign=top>
      <td valign=top width=48 class=tableitemnumber><?=$nbmsccount;?>&nbsp;&nbsp;&nbsp;</td>
      <td valign=top width=100 class=tableitem><?=stripslashes($trade_data['tradecode']);?>&nbsp;</td>
      <td valign=top width=200 class=tableitem><?=stripslashes($trade_data['tradedescription']);?>&nbsp;</td>
      <td valign=top width=230 class=tableitem>&nbsp;</td>
      <td valign=top width=130 class=tableitem style="text-align: center;">&nbsp;</td>
      <td valign=top width=100 class=tableitemnumeric>&nbsp;</td>
      <td valign=top width=120 class=tableitemnumeric><?=number_format($total_amount,2);?>&nbsp;</td>
      </tr>
      <?
      $nbmscitemcount=0;
      // get trade/items info
      $item_list = $mymroModel->getlist_mroitems($mynbmsc['mro_pkey']);
      foreach ($item_list as $myitem) {
        $nbmscitemcount++;
        $trade_data=$mytradeModel->getdata_trade($myitem['item_subsubtradepkey']);
        ?>
        <tr valign=top>
        <td valign=top width=48 class=tableitemnumber><?=$nbmsccount;?>.<?=$nbmscitemcount;?>&nbsp;&nbsp;&nbsp;</td>
        <td valign=top width=100 class=tableitem><?=stripslashes($trade_data['tradecode']);?>&nbsp;</td>
        <td valign=top width=200 class=tableitem>&nbsp;<?php //echo $mynbmsc['mro_pkey']; ?></td>
        <td valign=top width=230 class=tableitem><?=stripslashes($trade_data['tradedescription']);?>&nbsp;</td>
        <td valign=top width=130 class=tableitemnumeric style="text-align: center;"><?=number_format($myitem['item_quantity'],4);?> <?=$myitem['item_unit'];?>&nbsp;</td>
        <td valign=top width=100 class=tableitemnumeric><?=number_format($myitem['item_rate'],2);?>&nbsp;</td>
        <td valign=top width=120 class=tableitemnumeric><?=number_format(($myitem['item_quantity']*$myitem['item_rate']),2);?>&nbsp;</td>
        </tr>
      <? } ?>
    <? } ?>
    </table>
  </td>
  </tr>
  </table>
  <br>
  <!--<button name="viewmro4" id="viewmro4" onClick="mbl_button_viewmro(4);" style="width: 240px;"><img src="gfx/options/b_view.png" class="actionbutton">&nbsp;&nbsp;View Variance MROs - Subcon</button>&nbsp;-->
