{if $full_page}
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,listtable.js"}
<!-- 订单搜索 -->
<div class="form-div">
  <form action="javascript:searchOrder()" name="searchForm">
    <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
    {$lang.label_delivery_sn}<input name="delivery_sn" type="text" id="delivery_sn" size="15">
    {$lang.order_sn}<input name="order_sn" type="text" id="order_sn" size="15">
    {$lang.consignee|escape}<input name="consignee" type="text" id="consignee" size="15">
    {$lang.label_delivery_status}
    <select name="status" id="status">
      <option value="-1" selected="selected">{$lang.select_please}</option>
      {html_options options=$lang.delivery_status selected=-1}
    </select>
    <input type="submit" value="{$lang.button_search}" class="button" />
  </form>
</div>

<!-- 订单列表 -->
<form method="post" action="order.php?act=operate" name="listForm" onsubmit="return check()">
  <div class="list-div" id="listDiv">
{/if}

<table cellpadding="3" cellspacing="1">
  <tr>
    <th>
      <input onclick='listTable.selectAll(this, "delivery_id")' type="checkbox"/><a href="javascript:listTable.sort('delivery_sn', 'DESC'); ">{$lang.label_delivery_sn}</a>{$sort_delivery_sn}
    </th>
    <th><a href="javascript:listTable.sort('order_sn', 'DESC'); ">{$lang.order_sn}</a>{$sort_order_sn}</th>
    <th><a href="javascript:listTable.sort('add_time', 'DESC'); ">{$lang.label_add_time}</a>{$sort_add_time}</th>
    <th><a href="javascript:listTable.sort('consignee', 'DESC'); ">{$lang.consignee}</a>{$sort_consignee}</th>
    <th><a href="javascript:listTable.sort('update_time', 'DESC'); ">{$lang.label_update_time}</a>{$sort_update_time}</th>
    <th>{$lang.label_suppliers_name}</th>
    <th>{$lang.label_delivery_status}</th>
    <th>{$lang.operator}</th>
    <th>{$lang.handler}</th>
  <tr>
  {foreach from=$delivery_list item=delivery key=dkey}
  <tr>
    <td valign="top" nowrap="nowrap"><input type="checkbox" name="delivery_id[]" value="{$delivery.delivery_id}" />{$delivery.delivery_sn}</td>
    <td>{$delivery.order_sn}<br /></td>
    <td align="center" valign="top" nowrap="nowrap">{$delivery.add_time}</td>
    <td align="left" valign="top"><a href="mailto:{$delivery.email}"> {$delivery.consignee|escape}</a></td>
    <td align="center" valign="top" nowrap="nowrap">{$delivery.update_time}</td>
    <td align="center" valign="top" nowrap="nowrap">{$delivery.suppliers_name}</td>
    <td align="center" valign="top" nowrap="nowrap">{$delivery.status_name}</td>
    <td align="center" valign="top" nowrap="nowrap">{$delivery.action_user}</td>
    <td align="center" valign="top"  nowrap="nowrap">
     <a href="order.php?act=delivery_info&delivery_id={$delivery.delivery_id}">{$lang.detail}</a>
     <a onclick="{if(confirm('{$lang.confirm_delete}')){return true;}return false;}" href="order.php?act=operate&remove_invoice=1&delivery_id={$delivery.delivery_id}">{$lang.remove}</a>
    </td>
  </tr>
  {/foreach}
</table>

<!-- 分页 -->
<table id="page-table" cellspacing="0">
  <tr>
    <td align="right" nowrap="true">
    {include file="page.htm"}
    </td>
  </tr>
</table>

{if $full_page}
  </div>
    <div>

    <input name="remove_invoice" type="submit" id="btnSubmit3" value="{$lang.remove}" class="button" disabled="true" onclick="{if(confirm('{$lang.confirm_delete}')){return true;}return false;}" />
  </div>
</form>
<script language="JavaScript">
listTable.recordCount = {$record_count};
listTable.pageCount = {$page_count};

{foreach from=$filter item=item key=key}
listTable.filter.{$key} = '{$item}';
{/foreach}
{literal}

    onload = function()
    {
        // 开始检查订单
        startCheckOrder();

        //
        listTable.query = "delivery_query";
    }

    /**
     * 搜索订单
     */
    function searchOrder()
    {
        listTable.filter['order_sn'] = Utils.trim(document.forms['searchForm'].elements['order_sn'].value);
        listTable.filter['consignee'] = Utils.trim(document.forms['searchForm'].elements['consignee'].value);
        listTable.filter['status'] = document.forms['searchForm'].elements['status'].value;
        listTable.filter['delivery_sn'] = document.forms['searchForm'].elements['delivery_sn'].value;
        listTable.filter['page'] = 1;
        listTable.query = "delivery_query";
        listTable.loadList();
    }

    function check()
    {
      var snArray = new Array();
      var eles = document.forms['listForm'].elements;
      for (var i=0; i<eles.length; i++)
      {
        if (eles[i].tagName == 'INPUT' && eles[i].type == 'checkbox' && eles[i].checked && eles[i].value != 'on')
        {
          snArray.push(eles[i].value);
        }
      }
      if (snArray.length == 0)
      {
        return false;
      }
      else
      {
        eles['order_id'].value = snArray.toString();
        return true;
      }
    }
</script>
{/literal}

{include file="pagefooter.htm"}
{/if}