Option to ignore old CDRs, RT#81480
[freeside.git] / httemplate / edit / currency_exchange.html
1 <& /elements/header.html, 'Exchange rates' &>
2
3 <FORM METHOD="POST" ACTION="process/currency_exchange.html">
4
5 <& /elements/table-grid.html &>
6 % my $bgcolor1 = '#eeeeee';
7 %   my $bgcolor2 = '#ffffff';
8 %   my $bgcolor = '';
9
10 <TR>
11   <TH CLASS="grid" BGCOLOR="#cccccc">From</TH>
12   <TH CLASS="grid" BGCOLOR="#cccccc">Rate</TH>
13   <TH CLASS="grid" BGCOLOR="#cccccc">To</TH>
14 </TR>
15
16 %foreach my $currency (@currencies) {
17 %
18 %  if ( $bgcolor eq $bgcolor1 ) {
19 %    $bgcolor = $bgcolor2;
20 %  } else {
21 %    $bgcolor = $bgcolor1;
22 %  }
23 %
24 %  my %hash = ( 'from_currency' => $currency,
25 %               'to_currency'   => $to_currency,
26 %             );
27 %
28 %  my $currency_exchange = qsearchs('currency_exchange', \%hash)
29 %                         || new FS::currency_exchange   \%hash;
30 %
31 % $currency_exchange->rate('1.000000') if length($currency_exchange->rate) == 0;
32
33       <TR>
34
35         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
36           <% $currency %>: <% code2currency($currency) %>
37         </TD>
38
39         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ALIGN="right">
40           <INPUT TYPE      = "text"
41                  NAME      = "<% "$currency-$to_currency" %>"
42                  VALUE     = "<% $currency_exchange->rate %>"
43                  SIZE      = 14
44                  MAXLENGTH = 14
45           >
46         </TD>
47
48         <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
49           <% $to_currency %>: <% code2currency($to_currency) %>
50         </TD>
51
52       </TR>
53 % } 
54
55     </TABLE>
56
57 <BR>
58 <INPUT TYPE="submit" VALUE="Update rates">
59 </FORM>
60
61 <& /elements/footer.html &>
62 <%init>
63
64 die "access denied"
65   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
66
67 my $conf = new FS::Conf;
68
69 my $to_currency = $conf->config('currency') || 'USD';
70
71 my @currencies = sort { $a cmp $b } $conf->config('currencies');
72
73 </%init>