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

<table class="stdtable" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td colspan="2" class="header"> {t}Summary{/t} </td>
    <td colspan="2" class="headeraction"> <a href="#projects">{t}Projects{/t}</a> |
<a href="#persons">{t}Persons{/t}</a> |
<a href="#opcat">{t}Task categories{/t}</a> |
<a href="#customers">{t}Customers{/t}</a></td>
  </tr>

  {if (count($summary.projects.rows) > 0)}

  <tr><td colspan="3" class="section"> <a name="projects">{t}Projects{/t}</a> </td></tr>

 <tr>
    <td colspan="3" class="last">
      <table class="substdtable flleft" cellspacing="0">
       <tr>
          <th rowspan="2"> {t}Project{/t} </th>
          <th colspan="3" class="c"> {t}Duration{/t} </th>
          <th colspan="3" class="c"> {t}Manhours costs{/t} </th>
          <th colspan="3" class="c"> {t}Material costs{/t} </th>
          <th colspan="3" class="c"> {t}Total costs{/t} </th>
        </tr>
        <tr>
          <th class="time"> {t}Planned{/t} </th>
          <th class="time"> {t}Tracked{/t} </th>
          <th class="time"> % </th>
          <th class="time"> {t}Planned{/t} </th>
          <th class="time"> {t}Tracked{/t} </th>
          <th class="time"> % </th>
          <th class="time"> {t}Planned{/t} </th>
          <th class="time"> {t}Tracked{/t} </th>
          <th class="time"> % </th>
          <th class="time"> {t}Planned{/t} </th>
          <th class="time"> {t}Tracked{/t} </th>
          <th class="time"> % </th>
        </tr>

       {section name=r loop=$summary.projects.rows}
        <tr class="{cycle values="odd,even"}">
          <td> <a href="project.php?id={$summary.projects.rows[r].prj_id}">{$summary.projects.rows[r].prj_title|wash}</a></td>
          <td class="time"> {if ($summary.projects.rows[r].prj_planned_manhours > 0)}{$summary.projects.rows[r].prj_planned_manhours|phpaga_minutes2duration}{else}&nbsp;{/if} </td>
          <td class="time"> {$summary.projects.rows[r].prj_tracked_manhours|phpaga_minutes2duration|default:"&nbsp;"} </td>
          <td class="rb number{if $summary.projects.rows[r].prj_perc_manhours > 100} warn{/if}"> {$summary.projects.rows[r].prj_perc_manhours|phpaga_formatpercentage|default:"&nbsp;"} </td>
          
          <td class="time"> {$summary.projects.rows[r].prj_planned_cost_manhours|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.rows[r].prj_tracked_cost_manhours|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="rb number{if $summary.projects.rows[r].prj_perc_cost_manhours > 100} warn{/if}"> {$summary.projects.rows[r].prj_perc_cost_manhours|phpaga_formatpercentage|default:"&nbsp;"} </td>

          <td class="time"> {$summary.projects.rows[r].prj_planned_cost_material|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.rows[r].prj_tracked_cost_material|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="rb number{if $summary.projects.rows[r].prj_perc_cost_material > 100} warn{/if}"> {$summary.projects.rows[r].prj_perc_cost_material|phpaga_formatpercentage|default:"&nbsp;"} </td>

          <td class="time sumrow"> {if ($summary.projects.rows[r].planned_cost_total > 0)}{$summary.projects.rows[r].planned_cost_total|phpaga_formatamount}{else}&nbsp;{/if} </td>
          <td class="time sumrow"> {$summary.projects.rows[r].tracked_cost_total|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="number{if $summary.projects.rows[r].perc_cost_total > 100} warn{/if}"> {$summary.projects.rows[r].perc_cost_total|phpaga_formatpercentage|default:"&nbsp;"} </td>

        </tr>
        {/section}
        <tr class="summary">
          <td>&nbsp;</td>
          <td class="time"> {$summary.projects.planned_duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.tracked_duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
          <td> &nbsp; </td>
          <td class="time"> {$summary.projects.planned_cost_manhours|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.tracked_cost_manhours|phpaga_formatamount|default:"&nbsp;"} </td>
          <td> &nbsp; </td>
          <td class="time"> {$summary.projects.planned_cost_material|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.tracked_cost_material|phpaga_formatamount|default:"&nbsp;"} </td>
          <td> &nbsp; </td>
          <td class="time"> {$summary.projects.planned_cost_total|phpaga_formatamount|default:"&nbsp;"} </td>
          <td class="time"> {$summary.projects.tracked_cost_total|phpaga_formatamount|default:"&nbsp;"} </td>
          <td> &nbsp; </td>
        </tr>

     </table>

      <img class="flright" src="summary_graph.php?type=prj" alt="{t}Projects{/t}" title="{t}Projects{/t}" />
  </td>
  </tr>
  {/if}

  {if (count($summary.persons.rows) > 0)}

  <tr><td colspan="3" class="section"> <a name="persons"></a>{t}Persons{/t} </td></tr>
  <tr>
    <td colspan="3" class="last">
      <table class="substdtable flleft" cellspacing="0">
        <tr>
          <th> {t}Person{/t} </th>
          <th class="time"> {t}Duration{/t} </th>
        </tr>

        {section name=p loop=$summary.persons.rows}
        <tr class="{cycle values="odd,even"}">
          <td> <a href="person.php?id={$summary.persons.rows[p].pe_id}">{$summary.persons.rows[p].pe_person|wash}</a></td>
          <td class="time"> {$summary.persons.rows[p].sum_duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
        </tr>
        {/section}
        <tr class="summary">
          <td colspan="2" class="sumtime"> {$summary.persons.duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
        </tr>
      </table>

      <img src="summary_graph.php?type=pe" alt="{t}Persons{/t}" title="{t}Persons{/t}" />
    </td>
  </tr>

  {/if}

  {if (count($summary.opcats.rows) > 0)}

  <tr><td colspan="3" class="section"> <a name="opcat"></a>{t}Task categories{/t} </td></tr>
  <tr>
    <td colspan="3" class="last">
      <table class="substdtable flleft" cellspacing="0">
        <tr>
          <th> {t}Task category{/t} </th>
          <th class="time"> {t}Duration{/t} </th>
        </tr>

        {section name=o loop=$summary.opcats.rows}
        <tr class="{cycle values="odd,even"}">
          <td> {$summary.opcats.rows[o].opcat_title|wash}</td>
          <td class="time"> {$summary.opcats.rows[o].sum_duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
        </tr>
        {/section}
        <tr class="summary">
          <td colspan="2" class="sumtime"> {$summary.opcats.duration|phpaga_minutes2duration|default:"&nbsp;"} </td>
        </tr>
      </table>

      <img src="opcat_graph.php" alt="{t}Task categories{/t}" title="{t}Task categories{/t}" />
    </td>
  </tr>

  {/if}

  {if (count($summary.customers) > 0)}
  <tr><td colspan="3" class="section"> <a name="customers"></a>{t}Invoiced per customer and currency{/t} </td></tr>

  {foreach from=$summary.customers item=cust}

  <tr><td colspan="3" class="section"> {t}Currency{/t}: {$cust.curr_name} </td></tr>

  <tr>
    <td colspan="3" class="last">
      <table class="substdtable flleft" cellspacing="0">
        <tr>
          <th> {t}Customer{/t} </th>
          <th class="number"> {t}Invoiced{/t} </th>
        </tr>

        {section name=cu loop=$cust.rows}
        <tr class="{cycle values="odd,even"}">
          <td> <a href="company.php?id={$cust.rows[cu].cpn_id}">{$cust.rows[cu].cpn_name|wash}</a></td>
          <td class="time"> {$cust.rows[cu].sum_amount|phpaga_formatamount|default:"&nbsp;"} {$cust.rows[cu].curr_name|default:"&nbsp;"} </td>
        </tr>
        {/section}
        <tr class="summary">
          <td colspan="2" class="sumtime"> {$cust.amount|phpaga_formatamount|default:"&nbsp;"} {$cust.curr_name} </td>
        </tr>
      </table>

      <img src="summary_graph.php?type=cu&amp;curr_id={$cust.curr_id}" alt="{t}Projects{/t}" title="{t}Projects{/t}" />
  </tr>
{/foreach}

{/if}

</table>

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