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

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

  <fieldset class="search">
    <legend>{t}Select fiscal year and currency{/t}</legend>

    <label>{t}Fiscal year{/t}:</label>
    {html_select_date reverse_years=true time=$time start_year=$minYear end_year=$maxYear display_months=false display_days=false prefix=fin_}
    <br>

    <label for="curr_id">{t}Currency{/t}:</label>
    <select id="curr_id" name="curr_id">
      {html_options options=$currencies selected=$curr_id}
    </select>
    <br>

    <input type="submit" value="{t}Search{/t}">
  </fieldset>
</form>

{if count($cpndetails.details) < 1}

<div class="msg">{t}No data matching your search criteria was found.{/t}</div>

{else}

<div class="dcaption"><em>{$FINANCES_INFO} {t escape="0" 1=$curr_name 2=$YEAR 3=$fy_dates.start 4=$fy_dates.end}Amounts invoiced and received in %1, FY %2 (%3-%4){/t}</em>&nbsp;</div>

<div class="floatcontainer">
  <div class="flleft">
    <object type="image/svg+xml" data="finances_bpc_graph.php?year={$YEAR}&amp;currency={$CURRENCY}" height="{$smarty.const.PHPAGA_FINGRAPH_HEIGHT}" width="{$smarty.const.PHPAGA_FINGRAPH_WIDTH}">
      You need a browser capeable of SVG to display this image.
      You can find the Adobe SVG Viewer here:
      <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
    </object>
  </div>
  <div class="flleft">
    <object type="image/svg+xml" data="finances_bprpm_graph.php?year={$YEAR}&amp;currency={$CURRENCY}" height="{$smarty.const.PHPAGA_FINGRAPH_HEIGHT}" width="{$smarty.const.PHPAGA_FINGRAPH_WIDTH}">
      You need a browser capeable of SVG to display this image.
      You can find the Adobe SVG Viewer here:
      <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
    </object>
  </div>
</div>
<div class="spacer"></div>

{if count($cpndetails) > 0}
<table class="stdtable" cellspacing="0">
  <caption><em>{t}Per customer{/t}</em></caption>
  <tr>
    <th> {t}Customer{/t} </th>
    <th class="number"> {t escape="0" 1=$YEAR}Invoiced in FY %1{/t} </th>
    <th class="number"> {t escape="0" 1=$YEAR}Received in FY %1{/t} </th>
    <th class="number"> {t}Still unpaid{/t} </th>
  </tr>
  {section name=i loop=$cpndetails.details}
  <tr class="{cycle values="odd,even"}">
    <td class="desc"> <a href="company.php?id={$cpndetails.details[i].cpn_id}">{$cpndetails.details[i].cpn_name|wash}</a> </td>
    <td class="number"> {$cpndetails.details[i].sum_billed|phpaga_formatamount} </td>
    <td class="number"> {$cpndetails.details[i].sum_paid|phpaga_formatamount} </td>
    <td class="number"> {$cpndetails.details[i].sum_missing|phpaga_formatamount} </td>
  </tr>
  {/section}
  <tr class="summary">
    <td class="desc"> {t}Totals{/t} </td>
    <td class="number"> {$cpndetails.totals.billed|phpaga_formatamount} </td>
    <td class="number"> {$cpndetails.totals.paid|phpaga_formatamount} </td>
    <td class="number"> {$cpndetails.totals.missing|phpaga_formatamount} </td>
  </tr>
</table>
{/if}
{/if}

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