  <script type="text/javascript" src="calendar1.js"></script>
  <br>
  <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
  <form action="controllers/inputController.php" method="post" name="doform" id="doform">
  <input name="do_pkey" id="do_pkey" type="hidden" value="<?=$do_data['do_pkey'];?>">
  <input name="do_projectpkey" id="do_projectpkey" type="hidden" value="<?=$pubprojectpkey;?>">
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Supplier *</td>
  <td valign=top width=610 class=formvalue>
  <select name="do_supplierpkey" id="do_supplierpkey" style="width: 360px;">
  <? $objsupplierpkey=$do_data['do_supplierpkey']; ?>
  <? include('views/object-selectsupplier-limited.tpl'); ?>
  </select>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>DO No *</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_no" id="do_no" type="text" value="<?=$do_data['do_no'];?>" maxlength=40 style="width: 180px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>DO Date *</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_date" id="do_date" type="text" value="<?=unconverttounixslash($do_data['do_date']);?>" maxlength=10 style="width: 90px;" onKeypress="dateOnly();">
  <a href="javascript:cal1.popup();"><img src="images/icon/cal.gif" width="16" height="16" border="0" alt="Click to select date"></a>&nbsp;&nbsp;<i>(dd/mm/yyyy)</i>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>S/O No</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_sono" id="do_sono" type="text" value="<?=$do_data['do_sono'];?>" maxlength=40 style="width: 180px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Account No</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_accountno" id="do_accountno" type="text" value="<?=$do_data['do_accountno'];?>" maxlength=40 style="width: 180px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Delivery Address</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_address" id="do_address" type="text" value="<?=$do_data['do_address'];?>" style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Lorry No</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_lorryno" id="do_lorryno" type="text" value="<?=$do_data['do_lorryno'];?>" maxlength=40 style="width: 90px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Transport Company</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_transportco" id="do_transportco" type="text" value="<?=$do_data['do_transportco'];?>" maxlength=200 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Driver Name</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_drivername" id="do_drivername" type="text" value="<?=$do_data['do_drivername'];?>" maxlength=200 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Driver IC No</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_drivericno" id="do_drivericno" type="text" value="<?=$do_data['do_drivericno'];?>" maxlength=14 style="width: 180px;" onKeypress="nricOnly();">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Receiver Company</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_receiverco" id="do_receiverco" type="text" value="<?=$do_data['do_receiverco'];?>" maxlength=200 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Receiver Name</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_receivername" id="do_receivername" type="text" value="<?=$do_data['do_receivername'];?>" maxlength=200 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Receiver IC No</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_receivericno" id="do_receivericno" type="text" value="<?=$do_data['do_receivericno'];?>" maxlength=14 style="width: 180px;" onKeypress="nricOnly();">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Remarks</td>
  <td valign=top width=610 class=formvalue>
  <input name="do_remarks" id="do_remarks" type="text" value="<?=$do_data['do_remarks'];?>" style="width: 360px;">
  </td>
  </tr>
  <input name="job" id="job" type="hidden" value="">
  </form>
  </table>

  <? if ($pubtask=="edit") { ?>

  <br>

  <table border=1 cellspacing=1 cellpadding=2 width=920 style="border: 1px inset;">
  <tr valign=top>
  <td valign=top width=40 class=listheader>Item</td>
  <td valign=top width=250 class=listheader>Description</td>
  <td valign=top width=110 class=listheader>Unit</td>
  <td valign=top width=110 class=listheader>Qty Delivered</td>
  <td valign=top width=110 class=listheader>Qty Accepted</td>
  <td valign=top width=110 class=listheader>Qty Rejected</td>
  <td valign=top width=110 class=listheader>PO No</td>
  <td valign=top width=80 class=listheader>Options</td>
  </tr>

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

    <? $mypo = $mypoModel->getdata_po($myitem['item_popkey']); ?>

    <tr valign=top>
    <td valign=top width=40 class=listnumber><?=$myitem['recordno'];?>&nbsp;</td>
    <td valign=top width=250 class=listcontent><?=unescape($myitem['item_description']);?>&nbsp;</td>
    <td valign=top width=110 class=listcontent><?=$myitem['item_unit'];?>&nbsp;</td>
    <td valign=top width=110 class=listcontentnumeric><?=number_format($myitem['item_quantity'],4);?></td>
    <td valign=top width=110 class=listcontentnumeric><?=number_format($myitem['item_accepted'],4);?></td>
    <td valign=top width=110 class=listcontentnumeric><?=number_format(($myitem['item_quantity']-$myitem['item_accepted']),4);?>&nbsp;</td>
    <td valign=top width=110 class=listcontent><?=poidstr($mypo['po_no']);?>&nbsp;</td>
    <td valign=top width=80 class=listcontent>
    <? if ($myitem['item_status']==4) { ?>
      <i>Cancelled</i>
    <? } else { ?>
      <!--<a href="index.php?module=do&task=viewitem&doid=<?=$do_data['do_pkey'];?>&itemid=<?=$myitem['item_pkey'];?>"><img src="gfx/options/b_view.png" border=0 alt="View"></a>-->
      <? if (($pubuseraccess['access_do_edit']==1)||($pubuserrole>=2)) { ?>
        <!--<a href="index.php?module=do&task=edititem&doid=<?=$do_data['do_pkey'];?>&itemid=<?=$myitem['item_pkey'];?>"><img src="gfx/options/b_edit.png" border=0 alt="Edit"></a>-->
        <a href="index.php?module=do&task=deleteitem&doid=<?=$do_data['do_pkey'];?>&itemid=<?=$myitem['item_pkey'];?>"><img src="gfx/options/b_drop.png" border=0 alt="Delete"></a>
      <? } ?>
    <? } ?>
    </td>
    </tr>

  <? } ?>

  </table>

  <button name="additem" id="additem" type="button" onClick="do_button_additem('<?=$do_data['do_pkey'];?>');">&nbsp;<img src="gfx/options/b_add.png" class="actionbutton">&nbsp;&nbsp;Add Item&nbsp;</button>

  <? } ?>

  <script language="javascript">
    var cal1 = new calendar1(document.forms['doform'].elements['do_date']);
    cal1.year_scroll = true;
    cal1.time_comp = false;
  </script>

  <script type="text/javascript">

  function selectTrade() {
    window.open('views/ibox_selecttrade.php','selectwindow', 'menubar=0,toolbar=0,scrollbars=0,resizable=0,location=0,width=960,height=600');
    //location.href='index.php?module=crawler&task=spisearch';
  }

  function validateForm() {

    var isvalid=true;
    var errmsg="";
    var dono=document.getElementById('do_no');
    var dodate=document.getElementById('do_date');

    if ((dono.value=="")||(dodate=="")) {
      errmsg='DO No and DO Date must be specified!\n';
      isvalid=false;
    }
    if (isvalid==false) alert('Error:\n'+errmsg);
    return isvalid;

  }

  </script>
