  <br>
  <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Supplier Name</td>
  <td valign=top width=305 class=formvalue><?=$supplier_data['supplier_name'];?>&nbsp;</td>
  <td valign=top width=150 class=formlabel>Expected Delivery</td>
  <td valign=top width=305 class=formvalue><?=unconverttounixslash($mro_data['mro_deliverydate']);?>&nbsp;</td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>PO No</td>
  <td valign=top width=305 class=formvalue><?=poidstr($po_data['po_no'],$po_data['po_revno']);?>&nbsp;</td>
  <td valign=top width=150 class=formlabel>PO Date</td>
  <td valign=top width=305 class=formvalue><?=unconverttounixslash($po_data['po_date']);?>&nbsp;</td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>MRO No</td>
  <td valign=top width=305 class=formvalue><?=mroidstr($mro_data['mro_id']);?>&nbsp;</td>
  <td valign=top width=150 class=formlabel>RFQ No</td>
  <td valign=top width=305 class=formvalue><?=itqidstr($itq_data['itq_rfqno']);?>&nbsp;</td>
  </tr>
  </table>

  <? $icount=0; ?>

  <? foreach($po_items as $myitem) { ?>

    <? $icount++; ?>

    <br>
    <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
    <tr valign=top>
    <td valign=top width=40 class=listheader>No</td>
    <td valign=top width=300 class=listheader>Item</td>
    <td valign=top width=100 class=listheader>Unit</td>
    <td valign=top width=130 class=listheader>Qty</td>
    <td valign=top width=190 class=listheader>&nbsp;</td>
    </tr>
    <tr valign=top>
    <span style="cursor: pointer;" onClick="toggleDiv(<?=$icount;?>)">
    <td valign=top width=40 class=listnumber style="cursor: pointer;"><?=$icount;?></td>
    <td valign=top width=300 class=listcontent style="cursor: pointer;"><?=unescape($myitem['item_description']);?></td>
    <td valign=top width=100 class=listcontent style="cursor: pointer;"><?=$myitem['item_unit'];?></td>
    <td valign=top width=130 class=listcontentnumeric style="cursor: pointer;"><?=number_format($myitem['item_quantity'],4);?></td>
    <td valign=top width=190 class=listcontent>&nbsp;</td>
    </span>
    </tr>
    </table>

    <br>
    <div id="div-<?=$icount;?>" style="display: none;">
    <input name="tag-<?=$icount;?>" id="tag-<?=$icount;?>" type="hidden" value="0">

    <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
    <tr valign=top>
    <td valign=top width=40 class=listsubheader>No</td>
    <td valign=top width=200 class=listsubheader>DO No</td>
    <td valign=top width=200 class=listsubheader>Date Received</td>
    <td valign=top width=130 class=listsubheader>Qty</td>
    <td valign=top width=190 class=listsubheader>Remarks</td>
    </tr>

    <? // get dos
    $do_items = $mydoModel->getlist_dobypoitem($pubitemid, $myitem['item_subsubtradepkey']);
    $dcount=0;
    $dtotal=0;
    ?>

    <? foreach($do_items as $mydoitem) { ?>

      <? $dcount++; ?>
      <? $dtotal += $mydoitem['item_quantity']; ?>

      <tr valign=top>
      <td valign=top width=40 class=listnumber><?=$dcount;?></td>
      <td valign=top width=200 class=listcontent><?=$mydoitem['item_dono'];?></td>
      <td valign=top width=200 class=listcontent><?=unconverttounixslash($mydoitem['item_dodate']);?></td>
      <td valign=top width=130 class=listcontentnumeric><?=number_format($mydoitem['item_quantity'],4);?></td>
      <td valign=top width=190 class=listcontent><?=$mydoitem['item_remarks'];?></td>
      </tr>

    <? } ?>

    <tr valign=top>
    <td valign=top width=760 colspan=5 class=listcontent>&nbsp;</td>
    </tr>
    <tr valign=top>
    <td valign=top width=440 colspan=3 class=listcontent style="text-align: right;">
    Total Received&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <? if ($dtotal>$myitem['item_quantity']) { echo "<b>+</b>"; } else { echo "&nbsp;&nbsp;"; } ?>
    </td>
    <td valign=top width=130 class=listcontentnumeric><?=number_format($dtotal,4);?></td>
    <td valign=top width=190 class=listcontent>&nbsp;</td>
    </tr>

    </table>

    </div>

  <? } ?>

  <script type="text/javascript">

  function toggleDiv(divno) {

    var objdiv = document.getElementById('div-'+divno);
    var objtag = document.getElementById('tag-'+divno);

    if (objtag.value=="0") {
      objdiv.style.cssText="display: block;";
      objtag.value="1";
    } else {
      objdiv.style.cssText="display: none;";
      objtag.value="0";
    }

  }

  </script>
