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

<form action="{$smarty.const.PHPAGA_SELF}" method="get">

{if (count($summary.rows) > 0)}
<table class="stdtable" cellspacing="0">
  <tr>
    <td class="header" colspan="{if $percustomer}3{else}4{/if}"> {t}Unbilled hours{/t} </td>
    <td colspan="3" class="headeraction">
      {t}Group by{/t}:
      <select name="groupby">
        {html_options options=$phpaga_groupby selected=$groupby_sel}
      </select>
      <input type="submit" value="{t}Search{/t}" />
    </td>
  </tr>
  <tr>
    <th> {t}Customer{/t} </th>
    {if !$percustomer}
    <th> {t}Project{/t} </th>
    {/if}
    <th class="time"> {t}Hours{/t} </th>
    <th class="number"> {t}Amount{/t} </th>
    <th class="time"> {t}Between{/t} </th>
    <th class="time"> {t}And{/t} </th>
    <th> {t}Actions{/t} </th>
  </tr>

  {section name=i loop=$summary.rows}
  <tr class="{cycle values="odd,even"}">
    <td> <a href="company.php?id={$summary.rows[i].cpn_id}">{$summary.rows[i].cpn_name|wash}</a> </td>
    {if !$percustomer}
    <td{if ((strlen($summary.rows[i].prj_title) > $smarty.const.PHPAGA_SHOWPRJTITLELENGHT))} onmouseover="return escape('{$summary.rows[i].prj_title|phpaga_popup_sanitizestr}')"{/if}>
      <a href="project.php?id={$summary.rows[i].prj_id}"> {$summary.rows[i].prj_title|wash|truncate:$smarty.const.PHPAGA_SHOWPRJTITLELENGHT:"...":true} </a>
    </td>
    {/if}
    <td class="time"> {$summary.rows[i].prj_duration|phpaga_minutes2duration} </td>
    <td class="number"> {$summary.rows[i].prj_amount|phpaga_formatamount|default:"&nbsp;"} </td>
    <td class="time"> {$summary.rows[i].op_min_start|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
    <td class="time"> {$summary.rows[i].op_max_end|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
    <td class="actions">
      {if phpaga_user_hasperm($smarty.const.PHPAGA_PERM_MANAGE_INVOICES)}<a href="add_bill.php?{if !$percustomer}prj_id={$summary.rows[i].prj_id}{else}cpn_id={$summary.rows[i].cpn_id}{/if}&amp;op_billed={$smarty.const.PHPAGA_BILL_NOTBILLED}&amp;prj_billabletype=0&amp;action={$smarty.const.ACTION_BILL_WITHOPERATIONS}">Create invoice</a> | {/if}
      <a href="operations.php?{if !$percustomer}prj_id={$summary.rows[i].prj_id}{else}cpn_id={$summary.rows[i].cpn_id}{/if}&amp;op_billed={$smarty.const.PHPAGA_BILL_NOTBILLED}">View tasks</a>
    </td>
  </tr>
  {/section}

  <tr>
    <td{if !$percustomer} colspan="2"{/if}> &nbsp;</td>
    <td class="time"> {$summary.sum_duration|phpaga_minutes2duration} </td>
    <td class="number"> {$summary.sum_amount|phpaga_formatamount|default:"&nbsp;"} </td>
    <td colspan="4"> &nbsp; </td>
  </tr>
</table>
</form>

{else}
<div class="msg">{t}Currently there are no unbilled hours.{/t}</div>
{/if}

<!-- END subsection OPEN PROJECTS -->

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