<!-- BEGIN {$smarty.template} -->

<form action="{$FORM_ACTION}" method="get">

<table class="searchtable" cellspacing="0">
  <tr>
    <th colspan="3"> {t}Search invoices{/t} </th>
  </tr>
  <tr>
    <td class="label">{t}Invoice nr.{/t}: </td>
    <td colspan="2">
      <input type="text" class="tinput" name="bill_number" value="{$billInfo.bill_number|wash}" size="10" maxlength="10">
      {t}Payment status{/t}:
      <select name="bill_paid">
          {html_options options=$select_paid selected=$billInfo.bill_paid}
      </select>
    </td>
  </tr>
  <tr>
    <td class="label">{t}Recipient (company){/t}: </td>
    <td colspan="2">
      <select name="cpn_id">
	{html_options options=$select_cpn selected=$billInfo.cpn_id}
      </select>
    </td>
  </tr>
  <tr>
    <td class="label">{t}Billed Between{/t}: </td>
    <td colspan="2">
      <input type="text" class="tinput" name="bill_datefrom" value="{$billInfo.bill_datefrom|wash}" size="10" maxlength="10" id="sdate">
      <input type="image" src="img/phpaga/cal.png" id="btn_sdate">
      <span class="comment">(yyyy-mm-dd)</span>
    </td>
  </tr>
  <tr>
    <td class="label">{t}And{/t}: </td>
    <td>
      <input type="text" class="tinput" name="bill_dateto" value="{$billInfo.bill_dateto|wash}" size="10" maxlength="10" id="edate">
      <input type="image" src="img/phpaga/cal.png" id="btn_edate">
      <span class="comment">(yyyy-mm-dd)</span>
    </td>
    <td>
      <input type="submit" name="submit" value="{t}Search{/t}">
    </td>
  </tr>
</table>

</form>

<form action="bill_pdf.php" method="get" onsubmit="hideElement('printbill');">
{include file="bill_print.tpl.html"}

<table class="stdtable" cellspacing="0">
  <tr>
    <td class="header"> {t}Invoices{/t} </td>
    <td class="headeraction" colspan="4"> {if $perm_invoices}[ <a href="add_bill.php">{t}Add invoice{/t}</a>
      | <a href="operations.php?op_billed={$smarty.const.PHPAGA_BILL_NOTBILLED}">{t}Add invoice with tasks{/t}</a>
      | <a href="bills_csv.php?{$search_args}">{t}CSV Export{/t}</a>
      | <a class="ptr" onclick="showElement('printbill');">{t}Export selected to PDF{/t}</a>]
    {else}&nbsp;{/if} </td>
  </tr>

  {if (count($rows) > 0)}
  <tr>
    <th class="number"> {t}Invoice nr.{/t} </th>
    <th class="time"> {t}Invoice date{/t} </th>
    <th> {t}Recipient (company){/t} </th>
    <th class="time"> {t}Date paid{/t} </th>
    <th> &nbsp; </th>
  </tr>

  {section name=invoices loop=$rows}
  <tr class="{cycle values="odd,even"}">
    <td class="number"> <a href="bill.php?id={$rows[invoices].bill_id}">{$rows[invoices].bill_number|wash}</a> </td>
    <td class="time"> <a href="bill.php?id={$rows[invoices].bill_id}">{$rows[invoices].bill_date|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT}</a> </td>
    <td> <a href="company.php?id={$rows[invoices].cpn_id}">{$rows[invoices].cpn_name|wash}</a> </td>
    <td class="time"> {$rows[invoices].bill_paydate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
    <td class="last"> {if !strlen($rows[invoices].bill_paydate)}<input type="checkbox" name="id[]" value="{$rows[invoices].bill_id}">{else}&nbsp;{/if} </td>
  </tr>
  {/section}
  {else}
  <tr>
    <td class="last" colspan="5"> {t}No bills matching your search criteria were found.{/t} </td>
  </tr>
  {/if}
  {if strlen($BROWSE)}
  <tr>
    <td class="browse" colspan="5"> {$BROWSE} </td>
  </tr>
  {/if}
</table>

</form>

{literal}
<script type="text/javascript">
Calendar.setup({
inputField     :    "sdate",                     // id of the input field
ifFormat       :    "%Y-%m-%d",       // format of the input field
showsTime      :    false,                      // will display a time selector
button         :    "btn_sdate",                 // trigger for the calendar (button ID)
singleClick    :    true,                     // double-click mode
showOthers     :    true                       // show overlapping months
});
</script>

<script type="text/javascript">
Calendar.setup({
inputField     :    "edate",                     // id of the input field
ifFormat       :    "%Y-%m-%d",       // format of the input field
showsTime      :    false,                      // will display a time selector
button         :    "btn_edate",                 // trigger for the calendar (button ID)
singleClick    :    true,                     // double-click mode
showOthers     :    true                       // show overlapping months
});
</script>

{/literal}

<!-- END {$smarty.template} -->

